[PlasmaCore.IconItem] Regression: fix crash on source change

Summary:
When SvgSource is changed, old one is deleted. Connections are not automatically disconnected.
This change disconnects connections and fixes regression introduced in D28470.

BUG: 420801
FIXED-IN: 5.70

Test Plan:
STEPS TO REPRODUCE
1. click on mute button for a device
2. click on the desktop to collapse the applet
OBSERVED RESULT
crash in step 1 and in the rare case it doesn't crash it crash in step 2
EXPECTED RESULT
don't crash

Reviewers: #plasma, #frameworks, ngraham, davidedmundson

Reviewed By: ngraham

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29314
This commit is contained in:
Konrad Materka 2020-04-30 22:06:49 +02:00
parent 5a3fb570fe
commit 4b0d4c4bda

View File

@ -53,7 +53,6 @@ protected:
return m_iconItem->window();
}
private:
IconItem *m_iconItem;
};
@ -196,6 +195,10 @@ public:
}
}
~SvgSource() {
QObject::disconnect(m_iconItem, nullptr, m_svgIcon, nullptr);
}
bool isValid() const override
{
return m_svgIcon;