[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-01 21:34:35
Message-ID: 20130601213435.D0915AC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1356753 by pali:

Wrap Edit account dialog into QPointer

* Edit account dialog using KDialog::exec() function which can lead to memory corruption and double free
* After this change Jabber edit account dialog stopped crashing when applying changes

BUG: 306917
BUG: 306585
BUG: 243653
BUG: 244764
FIXED-IN: 4.11


 M  +4 -3      kopeteaccount.cpp  


--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteaccount.cpp #1356752:1356753
@@ -22,6 +22,7 @@
 #include <QTimer>
 #include <QPixmap>
 #include <QIcon>
+#include <QPointer>
 
 #include <kconfig.h>
 #include <kdebug.h>
@@ -683,7 +684,7 @@
 
 void Account::editAccount(QWidget *parent)
 {
-	KDialog *editDialog = new KDialog( parent );
+	QPointer <KDialog> editDialog = new KDialog( parent );
 	editDialog->setCaption( i18n( "Edit Account" ) );
 	editDialog->setButtons( KDialog::Ok | KDialog::Apply | KDialog::Cancel );
 
@@ -708,11 +709,11 @@
 	editDialog->setMainWidget( w );
 	if ( editDialog->exec() == QDialog::Accepted )
 	{
-		if( m_accountWidget->validateData() )
+		if( editDialog && m_accountWidget->validateData() )
 			m_accountWidget->apply();
 	}
 
-	editDialog->deleteLater();
+	delete editDialog;
 }
 
 void Account::setCustomIcon( const QString & i)
[prev in list] [next in list] [prev in thread] [next in thread] 

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