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

Revert "fix crash"

This reverts commit 246dd04279.
This commit is contained in:
Syarif Fakhri 2022-11-03 15:01:21 +08:00
parent 513bab4629
commit d255292714
4 changed files with 12 additions and 21 deletions

View File

@ -167,8 +167,14 @@ AutoHideDockContainerPrivate::AutoHideDockContainerPrivate(
//============================================================================ //============================================================================
CDockContainerWidget* CAutoHideDockContainer::parentContainer() const CDockContainerWidget* CAutoHideDockContainer::parentContainer() const
{ {
// Don't rely on the dock area parent container, when dragging or floating the parent container can change if (d->DockArea)
{
return d->DockArea->dockContainer();
}
else
{
return internal::findParent<CDockContainerWidget*>(this); return internal::findParent<CDockContainerWidget*>(this);
}
} }
@ -355,7 +361,7 @@ void CAutoHideDockContainer::moveContentsToParent()
//============================================================================ //============================================================================
void CAutoHideDockContainer::cleanupAndDelete(bool deleteDockArea) void CAutoHideDockContainer::cleanupAndDelete()
{ {
const auto dockWidget = d->DockWidget; const auto dockWidget = d->DockWidget;
if (dockWidget) if (dockWidget)
@ -369,15 +375,6 @@ void CAutoHideDockContainer::cleanupAndDelete(bool deleteDockArea)
hide(); hide();
deleteLater(); deleteLater();
// Schedule deletion of the dock area after the auto hide widget
// Otherwise, there are issues with the windows native event handler
if (deleteDockArea)
{
d->DockArea->setParent(nullptr);
d->DockArea->deleteLater();
d->DockArea = nullptr;
}
} }

View File

@ -134,10 +134,8 @@ public:
/** /**
* Cleanups up the side tab widget and then deletes itself * Cleanups up the side tab widget and then deletes itself
* deleteDockArea = true is set, this will also delete the dockArea.
* Avoid deleting the dock area floating drag, where the dock area is simply moved into another container
*/ */
void cleanupAndDelete(bool deleteDockArea = true); void cleanupAndDelete();
/* /*
* Toggles the auto Hide dock container widget * Toggles the auto Hide dock container widget

View File

@ -1957,16 +1957,12 @@ void CDockContainerWidget::registerAutoHideWidget(CAutoHideDockContainer* Autohi
d->AutoHideWidgets.append(AutohideWidget); d->AutoHideWidgets.append(AutohideWidget);
Q_EMIT autoHideWidgetCreated(AutohideWidget); Q_EMIT autoHideWidgetCreated(AutohideWidget);
ADS_PRINT("d->AutoHideWidgets.count() " << d->AutoHideWidgets.count()); ADS_PRINT("d->AutoHideWidgets.count() " << d->AutoHideWidgets.count());
qInfo()<< this << "Size after registering: " << d->AutoHideWidgets.size();
} }
//============================================================================ //============================================================================
void CDockContainerWidget::removeAutoHideWidget(CAutoHideDockContainer* AutohideWidget) void CDockContainerWidget::removeAutoHideWidget(CAutoHideDockContainer* AutohideWidget)
{ {
qInfo() << this << "Auto hide widgets: " << d->AutoHideWidgets;
qInfo() << "Size before removing: " << d->AutoHideWidgets.size();
d->AutoHideWidgets.removeAll(AutohideWidget); d->AutoHideWidgets.removeAll(AutohideWidget);
qInfo() << "Size after removing: " << d->AutoHideWidgets.size();
} }
//============================================================================ //============================================================================

View File

@ -371,11 +371,11 @@ void CFloatingDragPreview::cleanupAutoHideContainerWidget()
auto DroppedArea = qobject_cast<CDockAreaWidget*>(d->Content); auto DroppedArea = qobject_cast<CDockAreaWidget*>(d->Content);
if (DroppedDockWidget && DroppedDockWidget->autoHideDockContainer()) if (DroppedDockWidget && DroppedDockWidget->autoHideDockContainer())
{ {
DroppedDockWidget->autoHideDockContainer()->cleanupAndDelete(false); DroppedDockWidget->autoHideDockContainer()->cleanupAndDelete();
} }
if (DroppedArea && DroppedArea->autoHideDockContainer()) if (DroppedArea && DroppedArea->autoHideDockContainer())
{ {
DroppedArea->autoHideDockContainer()->cleanupAndDelete(false); DroppedArea->autoHideDockContainer()->cleanupAndDelete();
} }
} }