KDE/kdelibs/kio/kio

Thiago Macieira thiago at kde.org
Sun Nov 4 22:25:15 CET 2007


SVN commit 732832 by thiago:

Fix this bug properly instead of leaking memory: "this" got deleted by
slot connected to the readyRead() signal.

Moving the signal emission to the end of the function is a very good
practice. Deleting your senders is *not*. (Fixing that in the next
commit).

CCMAIL:kdelibs-bugs at kde.org


 M  +4 -4      connection.cpp  


--- trunk/KDE/kdelibs/kio/kio/connection.cpp #732831:732832
@@ -73,13 +73,13 @@
     if (!backend || suspended)
 	return;
 
-    if (!incomingTasks.isEmpty())
-        emit q->readyRead();
-
     while (!outgoingTasks.isEmpty()) {
        const Task task = outgoingTasks.dequeue();
        q->sendnow(task.cmd, task.data);
     }
+
+    if (!incomingTasks.isEmpty())
+        emit q->readyRead();
 }
 
 void ConnectionPrivate::commandReceived(const Task &task)
@@ -383,7 +383,7 @@
 Connection::~Connection()
 {
     close();
-//    delete d;  deleting causes crashes
+    delete d;
 }
 
 void Connection::suspend()


More information about the Kdelibs-bugs mailing list