mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-03-16 02:59:51 +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;
|
CDockContainerWidget *DropContainer = nullptr;
|
||||||
CDockAreaWidget *SingleDockArea = nullptr;
|
CDockAreaWidget *SingleDockArea = nullptr;
|
||||||
QPoint DragStartPos;
|
QPoint DragStartPos;
|
||||||
|
bool Hiding = false;
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
QWidget* MouseEventHandler = nullptr;
|
QWidget* MouseEventHandler = nullptr;
|
||||||
CFloatingWidgetTitleBar* TitleBar = nullptr;
|
CFloatingWidgetTitleBar* TitleBar = nullptr;
|
||||||
@ -455,6 +456,7 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->Hiding = true;
|
||||||
for (auto DockArea : d->DockContainer->openedDockAreas())
|
for (auto DockArea : d->DockContainer->openedDockAreas())
|
||||||
{
|
{
|
||||||
for (auto DockWidget : DockArea->openedDockWidgets())
|
for (auto DockWidget : DockArea->openedDockWidgets())
|
||||||
@ -462,6 +464,7 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
|||||||
DockWidget->toggleView(false);
|
DockWidget->toggleView(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
d->Hiding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -652,11 +655,22 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::updateWindowTitle()
|
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();
|
auto TopLevelDockArea = d->DockContainer->topLevelDockArea();
|
||||||
if (TopLevelDockArea)
|
if (TopLevelDockArea)
|
||||||
{
|
{
|
||||||
CDockWidget* CurrentWidget = TopLevelDockArea->currentDockWidget();
|
CDockWidget* CurrentWidget = TopLevelDockArea->currentDockWidget();
|
||||||
d->reflectCurrentWidget(CurrentWidget);
|
if (CurrentWidget)
|
||||||
|
{
|
||||||
|
d->reflectCurrentWidget(CurrentWidget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user