Skip to content

Commit

Permalink
BugFix: prevent crash in userwindows when closing profile (#4892)
Browse files Browse the repository at this point in the history
This seems to be a regression and running a git bisect to identify
when it was introduced points to: f94a494

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
(cherry picked from commit 16e2083)
  • Loading branch information
SlySven authored and vadi2 committed Mar 4, 2021
1 parent b474ea2 commit 2470020
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/TDockWidget.cpp
Expand Up @@ -65,17 +65,28 @@ void TDockWidget::moveEvent(QMoveEvent* event)

void TDockWidget::setVisible(bool visible)
{
if (!mpHost || !mpHost->mpConsole) {
// During shutdown / profile closure TDockWidgets will get a hide event
// as part of the underlying Qt class's built in handling of a close
// event as the base class QDockWidget::setVisible(bool) method is being
// overridden - at this point it seems there is not a Main Console left
// to be used to look some stuff up in - so in that case - just hide
// this widget and bail out:
if (!visible) {
QWidget::setVisible(false);
}
return;
}
auto pC = mpHost->mpConsole->mSubConsoleMap.value(widgetConsoleName);
auto pW = mpHost->mpConsole->mDockWidgetMap.value(widgetConsoleName);
if (!pC || !pW) {
if (!pC) {
return;
}
//do not change the ->show() order! Otherwise, it will automatically minimize the floating/dock window(!!)
if (visible) {
pC->show();
pW->QWidget::setVisible(true);
QWidget::setVisible(true);
mpHost->mpConsole->showWindow(widgetConsoleName);
} else {
pW->QWidget::setVisible(false);
QWidget::setVisible(false);
}
}

0 comments on commit 2470020

Please sign in to comment.