Commit cf12bf4a authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[kstyle] Unregister a shadow when it's destroyed

Summary:
Since lifetime of a KWindowShadow doesn't strictly match the lifetime
of the associated widget, we need to unregister the shadow when it's
destroyed in order to prevent accessing or deleting dangling pointers
afterwards.

BUG: 416854

Test Plan: plasmashell no longer crashes.

Reviewers: #plasma, broulik

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26966
parent 1e04ce2e
......@@ -377,7 +377,11 @@ namespace Breeze
// we want the shadow to be deleted after the decorated window is destroyed
if( !shadow )
{ shadow = new KWindowShadow( widget->windowHandle() ); }
{
shadow = new KWindowShadow( widget->windowHandle() );
connect( shadow, &QObject::destroyed, this, [this, widget] { _shadows.remove( widget ); } );
}
if( shadow->isCreated() )
{ shadow->destroy(); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment