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:
parent
4d1f5b2df0
commit
b43e864e8a
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,9 @@ public:
|
||||
signals:
|
||||
void interfacesChanged();
|
||||
|
||||
private:
|
||||
void setView(QObject *view);
|
||||
|
||||
private:
|
||||
QObject *m_globalShortcuts{nullptr};
|
||||
QObject *m_layoutsManager{nullptr};
|
||||
|
Loading…
Reference in New Issue
Block a user