mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
fix crash when using widgets that delete on close
This commit is contained in:
parent
5b3ad7e5db
commit
ad0c2103bf
@ -196,9 +196,6 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, CDockW
|
|||||||
updateSize();
|
updateSize();
|
||||||
|
|
||||||
parent->registerAutoHideWidget(this);
|
parent->registerAutoHideWidget(this);
|
||||||
|
|
||||||
d->DockArea->installEventFilter(this);
|
|
||||||
parent->installEventFilter(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -231,8 +228,7 @@ CAutoHideDockContainer::~CAutoHideDockContainer()
|
|||||||
ADS_PRINT("~CAutoHideDockContainer");
|
ADS_PRINT("~CAutoHideDockContainer");
|
||||||
|
|
||||||
// Remove event filter in case there are any queued messages
|
// Remove event filter in case there are any queued messages
|
||||||
d->DockArea->removeEventFilter(this);
|
qApp->removeEventFilter(this);
|
||||||
parent()->removeEventFilter(this);
|
|
||||||
|
|
||||||
if (d->DockManager)
|
if (d->DockManager)
|
||||||
{
|
{
|
||||||
@ -439,6 +435,8 @@ void CAutoHideDockContainer::collapseView(bool Enable)
|
|||||||
show();
|
show();
|
||||||
d->DockArea->show();
|
d->DockArea->show();
|
||||||
d->DockWidget->show();
|
d->DockWidget->show();
|
||||||
|
updateMask();
|
||||||
|
updateSize();
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1054,9 +1054,10 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CDockAreaWidget* DockArea = nullptr;
|
CDockAreaWidget* DockArea = nullptr;
|
||||||
|
CAutoHideDockContainer* dockContainer = nullptr;
|
||||||
if (!Testing)
|
if (!Testing)
|
||||||
{
|
{
|
||||||
const auto dockContainer = new CAutoHideDockContainer(DockManager, area, _this);
|
dockContainer = new CAutoHideDockContainer(DockManager, area, _this);
|
||||||
if (!dockContainer->restoreState(s, Testing))
|
if (!dockContainer->restoreState(s, Testing))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -1108,6 +1109,11 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s,
|
|||||||
DockArea->autoHideDockContainer()->toggleView(!Closed);
|
DockArea->autoHideDockContainer()->toggleView(!Closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dockContainer && !dockContainer->dockWidget())
|
||||||
|
{
|
||||||
|
dockContainer->cleanupAndDelete();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ void DockWidgetPrivate::updateParentDockArea()
|
|||||||
|
|
||||||
void DockWidgetPrivate::closeAutoHideDockWidgetsIfNeeded()
|
void DockWidgetPrivate::closeAutoHideDockWidgetsIfNeeded()
|
||||||
{
|
{
|
||||||
if (_this->dockContainer() && _this->dockContainer()->openedDockWidgets().isEmpty())
|
if (_this->dockContainer() && _this->dockContainer()->openedDockWidgets().isEmpty() && !_this->dockManager()->isRestoringState())
|
||||||
{
|
{
|
||||||
for (auto autoHideWidget : _this->dockContainer()->autoHideWidgets())
|
for (auto autoHideWidget : _this->dockContainer()->autoHideWidgets())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user