1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-10 21:18:19 +03:00

fix crash by releasing Interface *view properly

--when Latte::View is destroyed the Interfaces exposed
to qml should be informed also in order to not create
crashes
This commit is contained in:
Michail Vourlakos 2020-05-02 16:04:26 +03:00
parent 4d1f5b2df0
commit b43e864e8a
2 changed files with 17 additions and 2 deletions

View File

@ -54,6 +54,16 @@ QObject *Interfaces::view() const
return m_view;
}
void Interfaces::setView(QObject *view)
{
if (m_view == view) {
return;
}
m_view = view;
emit interfacesChanged();
}
QObject *Interfaces::plasmoidInterface() const
{
return m_plasmoid;
@ -70,9 +80,11 @@ void Interfaces::setPlasmoidInterface(QObject *interface)
m_layoutsManager = plasmoid->property("_latte_layoutsManager_object").value<QObject *>();
m_themeExtended = plasmoid->property("_latte_themeExtended_object").value<QObject *>();
m_universalSettings = plasmoid->property("_latte_universalSettings_object").value<QObject *>();
m_view = plasmoid->property("_latte_view_object").value<QObject *>();
setView(plasmoid->property("_latte_view_object").value<QObject *>());
emit interfacesChanged();
connect(m_view, &QObject::destroyed, this, [&]() {
setView(nullptr);
});
}
}

View File

@ -60,6 +60,9 @@ public:
signals:
void interfacesChanged();
private:
void setView(QObject *view);
private:
QObject *m_globalShortcuts{nullptr};
QObject *m_layoutsManager{nullptr};