Dialog: disconnect from QWindow signals in destructor

Summary:
When Dialog is being destroyed, its QWindow super-class may still emit
some signals from its destructor. Dialog is connected so some of them,
so this leads to Qt invoking slots on Dialog, whose destructor has
already been called, leading to crashes.

This patch disconnects all internal connections in Dialog's destructor.

See https://phabricator.kde.org/D23339 for details.

Test Plan: Plasma no longer crashes when a notification appears

Reviewers: #plasma, nicolasfella, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27671
This commit is contained in:
Daniel Vrátil 2020-02-26 10:00:41 +01:00
parent 10c112fccd
commit b6213cdd59
No known key found for this signature in database
GPG Key ID: 4D69557AECB13683

View File

@ -835,6 +835,9 @@ Dialog::~Dialog()
if (!QCoreApplication::instance()->closingDown()) {
DialogShadows::self()->removeWindow(this);
}
// Prevent signals from super-class destructor invoking our now-destroyed slots
disconnect(this, nullptr, this, nullptr);
}
QQuickItem *Dialog::mainItem() const