Added nullptr check to fix potential issue #171 - nullptr access closing a CFloatingDockContainer

This commit is contained in:
Uwe Kindler 2020-05-14 07:20:30 +02:00
parent 3011c0c030
commit 427b5a0be0

View File

@ -68,6 +68,7 @@ struct FloatingDockContainerPrivate
CDockContainerWidget *DropContainer = nullptr;
CDockAreaWidget *SingleDockArea = nullptr;
QPoint DragStartPos;
bool Hiding = false;
#ifdef Q_OS_LINUX
QWidget* MouseEventHandler = nullptr;
CFloatingWidgetTitleBar* TitleBar = nullptr;
@ -455,6 +456,7 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
return;
}
d->Hiding = true;
for (auto DockArea : d->DockContainer->openedDockAreas())
{
for (auto DockWidget : DockArea->openedDockWidgets())
@ -462,6 +464,7 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
DockWidget->toggleView(false);
}
}
d->Hiding = false;
}
//============================================================================
@ -652,11 +655,22 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
//============================================================================
void CFloatingDockContainer::updateWindowTitle()
{
// If this floating container will be hidden, then updating the window
// tile is not required anymore
if (d->Hiding)
{
return;
}
auto TopLevelDockArea = d->DockContainer->topLevelDockArea();
if (TopLevelDockArea)
{
CDockWidget* CurrentWidget = TopLevelDockArea->currentDockWidget();
d->reflectCurrentWidget(CurrentWidget);
if (CurrentWidget)
{
d->reflectCurrentWidget(CurrentWidget);
}
}
else
{