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

List:       kde-core-devel
Subject:    KGpg bug (memleak + cursor staying busy)
From:       bj () altern ! org
Date:       2004-08-08 10:25:35
Message-ID: 200408081226.42710.bj () altern ! org
[Download RAW message or body]

Hello.

Attached is a patch that fixes an issue in KGpg:
While performing a keyserver import/export, if you close the "abort" dialog 
window (eg. with alt-F4), the mouse cursor will stay busy forever, not 
reverting to an arrow, an orphaned gpg thread will remain open, and the abort 
dialog will leak...

The following patch fixes these issues (it just adds a destructiveclose flag 
to the dialog and connects the destroyed signal). 
It is quite trivial, and having a busy cursor hanging around is really 
annoying... 
Is it ok to commit ?

regards
Jean-Baptiste

["server.diff" (text/x-diff)]

Index: keyservers.cpp
===================================================================
RCS file: /home/kde/kdeutils/kgpg/keyservers.cpp,v
retrieving revision 1.44
diff -u -3 -r1.44 keyservers.cpp
--- keyservers.cpp	4 Aug 2004 19:13:04 -0000	1.44
+++ keyservers.cpp	8 Aug 2004 10:11:45 -0000
@@ -349,7 +349,7 @@
         QObject::connect(exportproc, SIGNAL(readReady(KProcIO *)),this, \
SLOT(slotimportread(KProcIO *)));  exportproc->start(KProcess::NotifyOnExit,true);
 	QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
-        importpop = new QDialog( this,0,true);
+        importpop = new QDialog( this,0,true,Qt::WDestructiveClose);
         QVBoxLayout *vbox=new QVBoxLayout(importpop,3);
         QLabel *tex=new QLabel(importpop);
         tex->setText(i18n("<b>Connecting to the server...</b>"));
@@ -359,14 +359,14 @@
         importpop->setMinimumWidth(250);
         importpop->adjustSize();
         importpop->show();
-        connect(Buttonabort,SIGNAL(clicked ()),this,SLOT(abortExport()));
+        connect(importpop,SIGNAL(destroyed ()),this,SLOT(abortExport()));
+	connect(Buttonabort,SIGNAL(clicked ()),this,SLOT(abortExport()));
 }
 
 void keyServer::abortExport()
 {
 	QApplication::restoreOverrideCursor();
-        if (importpop)
-                delete importpop;
+        importpop->close();
         if (exportproc->isRunning()) 
 	{
 	    disconnect(exportproc,0,0,0);
@@ -418,7 +418,7 @@
         QObject::connect(importproc, SIGNAL(readReady(KProcIO *)),this, \
SLOT(slotimportread(KProcIO *)));  importproc->start(KProcess::NotifyOnExit,true);
 	QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
-        importpop = new QDialog( this,0,true);
+        importpop = new QDialog( this,0,true,Qt::WDestructiveClose);
         QVBoxLayout *vbox=new QVBoxLayout(importpop,3);
         QLabel *tex=new QLabel(importpop);
         tex->setText(i18n("<b>Connecting to the server...</b>"));
@@ -429,18 +429,18 @@
         importpop->adjustSize();
         importpop->show();
         connect(Buttonabort,SIGNAL(clicked()),this,SLOT(abortImport()));
+	connect(importpop,SIGNAL(destroyed ()),this,SLOT(abortImport()));
 }
 
 void keyServer::abortImport()
 {
 	QApplication::restoreOverrideCursor();
-        if (importpop)
-                delete importpop;
+        importpop->close();
 	if (importproc->isRunning()) 
 	{
 	    disconnect(importproc,0,0,0);
+	    importproc->kill();
 	    emit importFinished(QString::null);
-	    importproc->kill();   
 	}
 	if (autoCloseWindow) close();
 }



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

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