From 846535c085de0cb7ddd09882029b9791c8d66ef3 Mon Sep 17 00:00:00 2001 From: mfreiholz Date: Tue, 23 Feb 2016 09:30:17 +0100 Subject: [PATCH] Fixes crash, if only a single SectionContent elemet has been added to ContainerWidget, make it floating and drop it back into ContainerWidget. --- AdvancedDockingSystem/src/ContainerWidget.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/AdvancedDockingSystem/src/ContainerWidget.cpp b/AdvancedDockingSystem/src/ContainerWidget.cpp index e7232d9..55e44d1 100644 --- a/AdvancedDockingSystem/src/ContainerWidget.cpp +++ b/AdvancedDockingSystem/src/ContainerWidget.cpp @@ -690,7 +690,19 @@ SectionWidget* ContainerWidget::dropContentOuterHelper(QLayout* l, const Interna sw->addContent(data, true); QSplitter* oldsp = findImmediateSplitter(this); - if (oldsp->orientation() == orientation + if (!oldsp) + { + QSplitter* sp = newSplitter(orientation); + if (l->count() > 0) + { + qWarning() << "Still items in layout. This should never happen."; + QLayoutItem* li = l->takeAt(0); + delete li; + } + l->addWidget(sp); + sp->addWidget(sw); + } + else if (oldsp->orientation() == orientation || oldsp->count() == 1) { oldsp->setOrientation(orientation);