dev  

Re: svn commit: r677505 - /apr/apr-util/trunk/misc/apr_reslist.c

Bojan Smojver
Thu, 17 Jul 2008 04:24:53 -0700

Quoting "Mladen Turk" <[EMAIL PROTECTED]>:

So the pool P is not destroyed before its subpools, only
the callback is called before subpools are destroyed.

True, but that's not what I see as the problem.

Imagine R is a database connection and S a prepared statement that depends on R (i.e. uses structures R points to during destruction). If R is destroyed (i.e. pointer to it points nowhere after that), any attempt to destroy S will give segfaults.

It is a reasonable APR application design to expect that if S registered a cleanup with the sub-pool of the pool from which R was allocated, that this cleanup will run OK. But, because R was already destroyed, this is not true any more.

Can't you just use malloc()/free() in destructor for temporary memory needs? Both should be localised to the destructor...


--
Bojan