From 1b91fe241b006366b99481842e437e96a0006227 Mon Sep 17 00:00:00 2001 From: mfreiholz Date: Wed, 17 Feb 2016 11:09:24 +0100 Subject: [PATCH] Use takeContents() for strict ownership switch. --- AdvancedDockingSystem/src/ContainerWidget.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/AdvancedDockingSystem/src/ContainerWidget.cpp b/AdvancedDockingSystem/src/ContainerWidget.cpp index 6d05692..4a56577 100644 --- a/AdvancedDockingSystem/src/ContainerWidget.cpp +++ b/AdvancedDockingSystem/src/ContainerWidget.cpp @@ -560,11 +560,20 @@ bool ContainerWidget::restoreSectionWidgets(QDataStream& in, QSplitter* currentS SectionWidget* sw = new SectionWidget(this); for (int i = 0; i < count; ++i) { - QString name; - in >> name; - const SectionContent::RefPtr sc = SectionContent::LookupMapByName.value(name).toStrongRef(); - if (sc) - sw->addContent(sc); + QString uname; + in >> uname; + const SectionContent::RefPtr sc = SectionContent::LookupMapByName.value(uname).toStrongRef(); + if (!sc) + { + qWarning() << "Can not find SectionContent:" << uname; + continue; + } + + InternalContentData data; + if (!this->takeContent(sc, data)) + continue; + + sw->addContent(sc); } sw->setCurrentIndex(currentIndex); currentSplitter->addWidget(sw);