From kde-commits Sun Apr 07 18:18:54 2002 From: Martijn Klingens Date: Sun, 07 Apr 2002 18:18:54 +0000 To: kde-commits Subject: kdenonbeta/kopete/kopete/library X-MARC-Message: https://marc.info/?l=kde-commits&m=101820369814672 kdenonbeta/kopete/kopete/library improtocol.cpp,1.13,1.14 improtocol.h,1.20,1.21 kopete.cpp,1.46,1.47 kopete.h,1.34,1.35 Author: mklingens Sun Apr 7 20:18:53 CEST 2002 In directory office:/tmp/cvs-serv11813/kopete/library Modified Files: improtocol.cpp improtocol.h kopete.cpp kopete.h Log Message: Much better fix for mETz's evil hack. Instead of deleting the plugin loader in QueryExit we delete it again in the kopete dtor. The Kopete ctor connects to the destoryed() signal of the mainwindow and makes m_mainWindow a null pointer after that. As a result kopeteApp->statusBar() and friends can now reliably detect deletion and also return 0L after that, which in turn can be queried by any code that might be run after deleting the main window. In case there are checks missing the backtrace also makes it immediately clear that you're operating on a null pointer instead of a dangling pointer (harder to see). Thanks to valgrind for pointing out the place where this crash was caused :) BTW: This is still not the perfect fix, since the perfect fix would be to turn about the whole Kopete API upside down. The plugins shouldn't access widgets of the main window or handle events from it in the first place. Communication between the app and the plugin should be _much_ more abstract and more signal-based. This requires quite some work to do, though, and I definitely don't expect to get that done anytime soon. In the mean time this is at least a decent fix that no longer qualifies as an extremely ugly hack.