The connection in your example doesn't use 'obj' at all (there are no
non-static overloads of connect() that allow binding to lambda
functions), so the crash can't be caused by deletion of that object.

On 09/03/2013 11:58 AM, Philipp Kursawe wrote:
> 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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to