panels: fixed bug that added panel to list twice and led to double-free

This commit is contained in:
itsmattkc
2020-04-29 00:01:50 +10:00
parent 61dd75a2ed
commit a412e26d66
2 changed files with 20 additions and 14 deletions
+3 -5
View File
@@ -35,12 +35,10 @@ PanelManager::PanelManager(QObject *parent) :
void PanelManager::DeleteAllPanels()
{
foreach (PanelWidget* panel, focus_history_) {
// We don't need to run this signal anymore since we're destroying and clearing everything
disconnect(panel, &PanelWidget::destroyed, this, &PanelManager::PanelDestroyed);
delete panel;
}
// Prevent any confusion regarding focus history by clearing it first
QList<PanelWidget*> copy = focus_history_;
focus_history_.clear();
qDeleteAll(copy);
}
const QList<PanelWidget *> &PanelManager::panels()