I've encountered a bug in combination with dynamically loaded libraries. Through some unavoidable things, log4cplus::Logger::getRoot().shutdown(); is called twice.
However, the per-thread data is released the first time, and get_ptd(false) in threadCleanup does not allocate a new one, so a 0-pointer is returned. So, a check if(ptd) is missing before the delete ptd.
From global-init.cxx
void
threadCleanup ()
{
// Do thread-specific cleanup.
internal::per_thread_data * ptd = internal::get_ptd (false);
delete ptd;
internal::set_ptd (0);
}
Should be something like:
void
threadCleanup ()
{
// Do thread-specific cleanup.
internal::per_thread_data * ptd = internal::get_ptd (false);
if(ptd)
delete ptd;
internal::set_ptd (0);
}
Diff:
The
if(ptd)is not necessary.delete nullptris a noop and should work just fine.