From kde-commits Mon Dec 06 10:12:13 2010 From: David Faure Date: Mon, 06 Dec 2010 10:12:13 +0000 To: kde-commits Subject: Re: KDE/kdelibs/kdecore Message-Id: <201012061112.15277.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129163038729350 On Monday 06 December 2010, Aurélien Gâteau wrote: > SVN commit 1204111 by gateau: > > Do not crash if an job was deleted in a slot connected to result() I don't agree that this is a valid use case. The rules are clear: do not delete an object in a slot connected to one of its signals. This is exactly why deleteLater() exists. I remember e.g. fixing code that used a socket and called delete in the slot for disconnected, instead of deleteLater... there, it's even documented: void QAbstractSocket::disconnected () [...] Warning: If you need to delete the sender() of this signal in a slot connected to it, use the deleteLater() function. [...] In addition, you added a guard in kjob.cpp itself, but what about the moc- generated code in between? When deleting the sender, we then go back to the signal emission code inside of a deleted object... I think this commit should be reverted. -- David Faure, faure@kde.org, http://www.davidfaure.fr Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).