1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-04-01 02:42:39 +08:00

change fix for crash on currentIndex invalid

This commit is contained in:
Syarif Fakhri 2022-11-02 12:40:45 +08:00
parent 44b2dc4b9d
commit 07355fa5b2
2 changed files with 2 additions and 6 deletions

View File

@ -311,7 +311,8 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
d->DockWidget = DockWidget;
d->SideTab->setDockWidget(DockWidget);
CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget();
if (OldDockArea)
// Don't remove dock widgets while restoring state, the current index pointer may be invalid
if (!DockWidget->dockManager()->isRestoringState() && OldDockArea)
{
OldDockArea->removeDockWidget(DockWidget);
}

View File

@ -1089,11 +1089,6 @@ bool DockContainerWidgetPrivate::restoreSideBar(CDockingStateReader& s,
{
continue;
}
const auto oldDockArea = DockWidget->dockAreaWidget();
if (oldDockArea)
{
oldDockArea->removeDockWidget(DockWidget);
}
auto SideBar = _this->sideTabBar(Area);
auto AutoHideContainer = SideBar->insertDockWidget(-1, DockWidget);