File apr-1.2.8-pool-cleanups.patch of Package libapr2

don't run cleanup handlers _after_ destroying subpools

diff -uNr apr-1.2.8.orig/memory/unix/apr_pools.c apr-1.2.8/memory/unix/apr_pools.c
--- apr-1.2.8.orig/memory/unix/apr_pools.c	2006-08-03 13:05:27.000000000 +0200
+++ apr-1.2.8/memory/unix/apr_pools.c	2007-05-24 16:48:38.664845000 +0200
@@ -682,14 +682,14 @@
     /* Destroy the subpools.  The subpools will detach themselves from
      * this pool thus this loop is safe and easy.
      */
-    while (pool->child)
-        apr_pool_destroy(pool->child);
-
     /* Run cleanups */
     run_cleanups(&pool->cleanups);
     pool->cleanups = NULL;
     pool->free_cleanups = NULL;
 
+    while (pool->child)
+        apr_pool_destroy(pool->child);
+
     /* Free subprocesses */
     free_proc_chain(pool->subprocesses);
     pool->subprocesses = NULL;
@@ -1362,17 +1362,17 @@
     debug_node_t *node;
     apr_uint32_t index;
 
+    /* Run cleanups */
+    run_cleanups(&pool->cleanups);
+    pool->free_cleanups = NULL;
+    pool->cleanups = NULL;
+
     /* Destroy the subpools.  The subpools will detach themselves from
      * this pool thus this loop is safe and easy.
      */
     while (pool->child)
         pool_destroy_debug(pool->child, file_line);
 
-    /* Run cleanups */
-    run_cleanups(&pool->cleanups);
-    pool->free_cleanups = NULL;
-    pool->cleanups = NULL;
-
     /* If new child pools showed up, this is a reason to raise a flag */
     if (pool->child)
         abort();