mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Added nullptr check to fix potential issue #171 - nullptr access closing a CFloatingDockContainer
This commit is contained in:
parent
3011c0c030
commit
427b5a0be0
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user