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

Philipp Kursawe phil.kursawe at gmail.com
Tue Sep 3 09:58:28 CEST 2013


Using this code:

@
obj->connect(sender, &Sender::signal, [] {
});

// later
obj->deleteLater();
@

The object will be deleted, but the connection will not be broken, and
the sender can still signal, the lambda will be called, but of course
it will crash. Is this a known limitation of using lambdas?

I know I could remember the connection and call
disconnect(connectionId) in my Objects dtor, but this manual work can
be easily overlooked

Any ideas?

Phil



More information about the Interest mailing list