From kde-core-devel Sun Aug 08 10:25:35 2004
From: bj () altern ! org
Date: Sun, 08 Aug 2004 10:25:35 +0000
To: kde-core-devel
Subject: KGpg bug (memleak + cursor staying busy)
Message-Id: <200408081226.42710.bj () altern ! org>
X-MARC-Message: https://marc.info/?l=kde-core-devel&m=109196073524703
MIME-Version: 1
Content-Type: multipart/mixed; boundary="--Boundary-00=_CwhFBZ+QewlCglV"
--Boundary-00=_CwhFBZ+QewlCglV
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
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
--Boundary-00=_CwhFBZ+QewlCglV
Content-Type: text/x-diff;
charset="us-ascii";
name="server.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="server.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("Connecting to the server..."));
@@ -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("Connecting to the server..."));
@@ -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();
}
--Boundary-00=_CwhFBZ+QewlCglV--