[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/libkopete
From:       Pali Rohár <pali.rohar () gmail ! com>
Date:       2013-06-02 10:17:47
Message-ID: 20130602101747.C6D2BAC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1356787 by pali:

Assign null pointer to all Kopete singleton instances after are deleted
This prevent returning invalid pointer by self() functions


 M  +3 -1      avdevice/videodevicepool.cpp  
 M  +1 -0      kopeteavatarmanager.cpp  
 M  +1 -0      kopetecontactlist.cpp  
 M  +1 -0      kopeteglobal.cpp  
 M  +2 -0      kopeteidletimer.cpp  
 M  +3 -1      kopeteinfoeventmanager.cpp  
 M  +2 -0      kopetemessagehandler.cpp  
 M  +4 -1      kopetestatusmanager.cpp  
 M  +3 -1      private/kopeteutils_private.cpp  


--- trunk/KDE/kdenetwork/kopete/libkopete/avdevice/videodevicepool.cpp \
#1356786:1356787 @@ -28,6 +28,7 @@
 #include <kglobal.h>
 #include <kconfig.h>
 #include <kconfiggroup.h>
+#include <qapplication.h>
 #include <qdir.h>
 #include <solid/device.h>
 #include <solid/devicenotifier.h>
@@ -70,7 +71,7 @@
     \brief Constructor of class VideoDevicePool
  */
 VideoDevicePool::VideoDevicePool()
-: m_current_device(-1)
+: QObject(qApp), m_current_device(-1)
 {
 	connect( Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(QString)), \
SLOT(deviceAdded(QString)) );  connect( Solid::DeviceNotifier::instance(), \
SIGNAL(deviceRemoved(QString)), SLOT(deviceRemoved(QString)) ); @@ -87,6 +88,7 @@
  */
 VideoDevicePool::~VideoDevicePool()
 {
+	s_self = 0L;
 	foreach ( VideoDevice* vd, m_videodevices )
 		delete vd;
 }
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteavatarmanager.cpp #1356786:1356787
@@ -92,6 +92,7 @@
 
 AvatarManager::~AvatarManager()
 {
+	s_self = 0L;
 	delete d;
 }
 
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetecontactlist.cpp #1356786:1356787
@@ -104,6 +104,7 @@
 
 ContactList::~ContactList()
 {
+	s_self=0L;
 	delete d->myself;
 	delete d;
 }
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteglobal.cpp #1356786:1356787
@@ -81,6 +81,7 @@
 Properties::~Properties()
 {
 	kDebug(14000) ;
+	mSelf = 0L;
 	delete d;
 }
 
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteidletimer.cpp #1356786:1356787
@@ -81,6 +81,8 @@
 
 Kopete::IdleTimer::~IdleTimer()
 {
+	instance = 0L;
+
 	delete d->platform;
 
 	delete d;
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteinfoeventmanager.cpp #1356786:1356787
@@ -16,6 +16,7 @@
 #include "kopeteinfoeventmanager.h"
 #include "kopeteinfoevent.h"
 
+#include <QApplication>
 #include <QStringList>
 
 namespace Kopete {
@@ -29,13 +30,14 @@
 InfoEventManager *InfoEventManager::instance = 0L;
 
 InfoEventManager::InfoEventManager()
- : QObject(), d( new Private )
+ : QObject( qApp ), d( new Private )
 {
 }
 
 
 InfoEventManager::~InfoEventManager()
 {
+	instance = 0L;
 	delete d;
 }
 
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetemessagehandler.cpp #1356786:1356787
@@ -93,6 +93,8 @@
 
 MessageHandlerFactory::~MessageHandlerFactory()
 {
+	if (g_list.isDestroyed())
+		return;
  	Private::factories().erase( d->iterator );
 	delete d;
 }
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetestatusmanager.cpp #1356786:1356787
@@ -15,6 +15,7 @@
 */
 #include "kopetestatusmanager.h"
 
+#include <QApplication>
 #include <QtCore/QFile>
 #include <QtXml/QDomElement>
 #include <QtCore/QTimer>
@@ -58,7 +59,7 @@
 };
 
 StatusManager::StatusManager()
-	: QObject(), d( new Private )
+	: QObject( qApp ), d( new Private )
 {
 	d->away = false;
 	d->root = 0;
@@ -80,6 +81,8 @@
 
 StatusManager::~StatusManager()
 {
+	instance = 0L;
+
 	delete d->idleTimer;
 
 	delete d->root;
--- trunk/KDE/kdenetwork/kopete/libkopete/private/kopeteutils_private.cpp \
#1356786:1356787 @@ -14,6 +14,7 @@
     *************************************************************************
 */
 
+#include <qapplication.h>
 #include <qmap.h>
 
 #include <kmessagebox.h>
@@ -31,12 +32,13 @@
 
 NotifyHelper* NotifyHelper::s_self = 0L;
 
-NotifyHelper::NotifyHelper()
+NotifyHelper::NotifyHelper() : QObject(qApp)
 {
 }
 
 NotifyHelper::~NotifyHelper()
 {
+	s_self = 0L;
 }
 
 NotifyHelper* NotifyHelper::self()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic