SVN commit 728913 by ereslibre:

Thanks to Bille for the pointing out. This code does not need a static deleter 
or a k_global_static* definition, since when the parent is deleted this object 
will also be. 
It won't leak since it will check if the object did exist before, so... This 
code was crashing because of several deletions over the same memory address, 
that means the 
qobject deleter as well as the kcleanupglobalstatic destructor. No crashes on 
exit.

CCMAIL: [email protected]


 M  +7 -2      kopetestdaction.cpp  
 M  +2 -0      kopetestdaction.h  


--- trunk/KDE/kdenetwork/kopete/libkopete/ui/kopetestdaction.cpp #728912:728913
@@ -30,14 +30,13 @@
 #include <kwindowsystem.h>
 #include <kcmultidialog.h>
 #include <kicon.h>
-#include <kglobal.h>
 
 #include "kopetecontactlist.h"
 #include "kopetegroup.h"
 #include "kopeteuiglobal.h"
 #include <kactioncollection.h>
 
-K_GLOBAL_STATIC_WITH_ARGS(KSettings::Dialog, s_settingsDialog, 
(Kopete::UI::Global::mainWidget()))
+KSettings::Dialog *KopetePreferencesAction::s_settingsDialog = 0L;
 
 KopetePreferencesAction::KopetePreferencesAction( KActionCollection *parent, 
const char *name )
 : KAction( KIcon(KStandardGuiItem::configure().iconName()), 
KStandardGuiItem::configure().text(), parent )
@@ -52,6 +51,12 @@
 
 void KopetePreferencesAction::slotShowPreferences()
 {
+       // No need of static deleter since when the parent is deleted, the 
settings dialog is deleted (ereslibre)
+       if ( !s_settingsDialog )
+       {
+               s_settingsDialog = new KSettings::Dialog( 
Kopete::UI::Global::mainWidget() );
+       }
+
        s_settingsDialog->show();
 
        s_settingsDialog->raise();
--- trunk/KDE/kdenetwork/kopete/libkopete/ui/kopetestdaction.h #728912:728913
@@ -119,6 +119,8 @@
 
          protected slots:
                         void slotShowPreferences();
+         private:
+                        static KSettings::Dialog *s_settingsDialog;
 };
 
 #endif
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to