Review Request 116712: [kwin] Disconnect lambda connection on destroy of slide effect

Thomas Lübking thomas.luebking at gmail.com
Tue Mar 11 17:29:33 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116712/#review52665
-----------------------------------------------------------


tried passing "this" as context?

QMetaObject::Connection QObject::connect(const QObject * sender, PointerToMemberFunction signal, const QObject * context, Functor functor, Qt::ConnectionType type) [static]
...
Creates a connection of a given type from signal in sender object to functor to be placed in a specific event loop of context, and returns a handle to the connection
...
The connection will automatically disconnect if the sender or the context is destroyed.

- Thomas Lübking


On March 11, 2014, 1:26 p.m., Martin Gräßlin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116712/
> -----------------------------------------------------------
> 
> (Updated March 11, 2014, 1:26 p.m.)
> 
> 
> Review request for kwin, Plasma and Sebastian Kügler.
> 
> 
> Repository: kde-workspace
> 
> 
> Description
> -------
> 
> [kwin] Disconnect lambda connection on destroy of slide effect
> 
> Lambda connections are tricky: they do not get automatically
> disconnected when the captured [this] gets destroyed, but they get
> disconnected when the sender object gets destroyed.
> 
> Thus the slide effect was crashing if it got disabled and a window
> got deleted, because the connection was still present and tried to
> access the destroyed this pointer.
> 
> To circumvent we need to store the QMetaObject::Connection and
> disconnect when the SlideEffect gets destroyed. To not clutter the
> private variables it's using another lambda.
> 
> --
> Plasma and sebas are only added to highlight this GOTCHA!
> 
> 
> Diffs
> -----
> 
>   kwin/effects/slide/slide.cpp e6a8d588fe6ef7c7cb2981b0d49bf2c670753e2d 
> 
> Diff: https://git.reviewboard.kde.org/r/116712/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Martin Gräßlin
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20140311/9e7e4e5a/attachment-0001.html>


More information about the Plasma-devel mailing list