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

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdecore
From:       David Faure <faure () kde ! org>
Date:       2010-12-06 10:12:13
Message-ID: 201012061112.15277.faure () kde ! org
[Download RAW message or body]

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).

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

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