licq-im / licq

An instant messaging client for UNIX
http://www.licq.org/
16 stars 4 forks source link

Crash if plugin load fails during startup #34

Closed flynd closed 10 years ago

flynd commented 10 years ago

If Licq startup fails after at least one plugin has loaded, the plugin unload will trigger "pure virtual method called".

Steps to reproduce: Modify licq.conf to contain two plugins. Plugin1 must be valid and Plugin2 must fail (either be non-existent or be build for the wrong Licq-version). Example: [plugins] NumPlugins=2 Plugin1=/usr/local/lib/licq/licq_qt4-gui.so Plugin2=non_existing_dummy

I have debugged this a bit and found that the fault is triggered in ~GeneralPluginInstance. I also notice that the Qt4Gui Factory object is destroyed before ~GeneralPluginInstance calls destroyPlugin for the Qt4Gui.

I'm guessing the plugin instance need to hold a shared pointer of the plugin to make sure objects are deallocated in the correct order but I don't know how to add this as I currently fail to understand how all the plugin objects and shared pointers work together.