Bojan Smojver
Sat, 19 Jul 2008 20:04:43 -0700
Quoting "Bojan Smojver" <[EMAIL PROTECTED]>:
PPS. The situation I was referring to in my previous e-mails cannot actually happen. R always outlives S.
This e-mail was written before pre_cleanup bug in apr_pools.c was fixed, hence my PPS. However, let me reiterate one point: if people hang cleanups that depend on the resource off the sub-pool created in the constructor, but don't destroy the sub-pool in the destructor, they can be in trouble.
In other words: constructor: create sub-pool create resource (non-pool space) register cleanup in sub-pool, dependent on resource destructor: destroy resourceThe above will lead in the subsequent sub-pool destruction (through the regular pool machinery) to segfaults (because that cleanup will refer to already destroyed resource).
So, the writers should be aware that that they _must_ call apr_pool_destroy() in the destructor on any sub-pool they created in the constructor.
-- Bojan