Hi, there have been a lot of reports of GM crashing on exit in PFactory::~PFactory with the packages comming with SuSE 9.3. Although this bug only seems to happen on this particular distribution, it is a bug in pwlib. I dont know why only SuSE 9.3 is affected, but it may become visible on other distributions in future. Details: The crash is happening in PFactory<PSoundChannel>::~PFactory() on line 319 of include/ptlib/pfactory.h: --- if(entry->second->isDynamic) delete entry->second; --- entry->second is a dangling Pointer pointing to somewhere in stack space. It is initialized via the plugin code. in include/ptlib/plugin.h:165: class PPlugin_##serviceType##_##serviceName##_Registration { public: PPlugin_##serviceType##_##serviceName##_Registration(...) { static PDevicePluginFactory<serviceType>::Worker factory(#serviceName); pluginMgr->RegisterService(#serviceName, #serviceType, descriptor); } } Here we have serviceType=PSoundChannel, serviceName=ALSA. So what happens is, we are first creating a static instance of PDevicePluginFactory<PSoundChannel>::Worker named factory. In the constructor of factory, we are calling "PFactory<PSoundChannel>::Register("ALSA", this), so a pointer to the static instance called factory is stored in the keyMap with a key with value "ALSA". Everything fine until now ... Next, in (src/ptlib/common/pluginmgr.cxx) PPluginManager::RegisterService(...) "adapter = PFactory<>::CreateInstance(PSoundChannel)" is called, and for this "adapter->CreateFactory("ALSA");" This creates (plugin.h:87) a second PDevicePluginFactory<PSoundChannel>::Worker on the heap, the pointer to this instance is not stored in the keyMap (no values are stored for already existing keys). On shutdown, the PluginManager is destroyed, and the static instance "factory" is destroyed, too, making the pointer in the keyMap a dangling pointer. Later, the PFactory<PSoundChannel> is destroyed, and the dangling pointer is hit -> crash! Greetings, Stefan -- Stefan Brüns / Kastanienweg 6 - Zimmer 1206 / 52074 Aachen mailto:lurch gmx li http://www.kawo1.rwth-aachen.de/~lurchi/ phone: +49 241 169-4206 mobile: +49 160 3797725
Attachment:
pgpeGqIaZnS2o.pgp
Description: PGP signature