[Interest] Fwd: Lambda based connections are not disconnected upon QObject deletion

Philipp Kursawe phil.kursawe at gmail.com
Mon Sep 9 07:06:04 CEST 2013


Thanks for the 5.2 update. Currently I keep the result from connect as you say.

On Mon, Sep 9, 2013 at 1:08 AM, Thiago Macieira
<thiago.macieira at intel.com> wrote:
> On domingo, 8 de setembro de 2013 23:55:15, Philipp Kursawe wrote:
>> Well, my example was not complete.Of course the lambda code does
>> something in real. The problem seems to be, that Qt by itself does not
>> delete lambda based connections properly.
>
> it deletes them when the *sender* is deleted. It doesn't know what the lambda
> does, so there's no way to tell to delete when one of the variables inside the
> lambda becomes invalid.
>
> In Qt 5.2, you will be able to associate them also with a receiver, in which
> case the connection will be deleted when either sender or receiver is deleted.
>
> To do more complex things, keep the return result from connect() and use it to
> disconnect.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list