diff --git a/app/declarativeimports/interfaces.cpp b/app/declarativeimports/interfaces.cpp index 4d94886d7..dfcce9ba1 100644 --- a/app/declarativeimports/interfaces.cpp +++ b/app/declarativeimports/interfaces.cpp @@ -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(); m_themeExtended = plasmoid->property("_latte_themeExtended_object").value(); m_universalSettings = plasmoid->property("_latte_universalSettings_object").value(); - m_view = plasmoid->property("_latte_view_object").value(); + setView(plasmoid->property("_latte_view_object").value()); - emit interfacesChanged(); + connect(m_view, &QObject::destroyed, this, [&]() { + setView(nullptr); + }); } } diff --git a/app/declarativeimports/interfaces.h b/app/declarativeimports/interfaces.h index 26a0669ed..b7682e6f8 100644 --- a/app/declarativeimports/interfaces.h +++ b/app/declarativeimports/interfaces.h @@ -60,6 +60,9 @@ public: signals: void interfacesChanged(); +private: + void setView(QObject *view); + private: QObject *m_globalShortcuts{nullptr}; QObject *m_layoutsManager{nullptr};