diff --git a/shell/panelview.cpp b/shell/panelview.cpp index 66a1c24d1..c8c3c714c 100644 --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -1029,7 +1029,6 @@ void PanelView::containmentChanged() } views.sync(); } - deleteLater(); } }, Qt::QueuedConnection); } diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index ea3768a8e..667bb8dc5 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -1031,15 +1031,16 @@ void ShellCorona::createWaitingPanels() panel->show(); cont->reactToScreenChange(); - connect(cont, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDeleted(QObject*))); + connect(cont, &QObject::destroyed, this, &ShellCorona::panelContainmentDestroyed); } m_waitingPanels = stillWaitingPanels; emit availableScreenRectChanged(); } -void ShellCorona::containmentDeleted(QObject *cont) +void ShellCorona::panelContainmentDestroyed(QObject *cont) { - m_panelViews.remove(static_cast(cont)); + auto view = m_panelViews.take(static_cast(cont)); + view->deleteLater(); emit availableScreenRectChanged(); } diff --git a/shell/shellcorona.h b/shell/shellcorona.h index b04b10236..b803239eb 100644 --- a/shell/shellcorona.h +++ b/shell/shellcorona.h @@ -180,7 +180,6 @@ private Q_SLOTS: void checkAddPanelAction(const QStringList &sycocaChanges = QStringList()); void addPanel(); void addPanel(QAction *action); - void containmentDeleted(QObject* cont); void populateAddPanelsMenu(); void outputEnabledChanged(); @@ -190,6 +189,7 @@ private Q_SLOTS: void activityOpened(); void activityClosed(); void activityRemoved(); + void panelContainmentDestroyed(QObject* cont); void desktopContainmentDestroyed(QObject*); void showOpenGLNotCompatibleWarning(); void alternativesVisibilityChanged(bool visible);