From ae0b98a32a37a2ab0213e42e2de0652d77900310 Mon Sep 17 00:00:00 2001 From: Aleksei German Date: Thu, 27 Aug 2020 18:50:36 +0200 Subject: [PATCH] QmlDesigner: Fix for States compilation break Fixing compilation break in StatesEditorView: QtCreator is build with 5.12 QScopeGuard is from 5.14+ Replaced scope guard with unique_ptr original task: QDS-2312 Change-Id: Id6a4bf513f37675044b073be2dfe52e3fa9dc3bc Reviewed-by: Christian Stenger --- .../stateseditor/stateseditorview.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index 78ac9da2303..a74b86b828b 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -30,8 +30,8 @@ #include #include -#include #include +#include #include @@ -279,8 +279,8 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -300,8 +300,8 @@ void StatesEditorView::resetWhenCondition(int internalNodeId) return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -321,8 +321,8 @@ void StatesEditorView::setStateAsDefault(int internalNodeId) return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -342,8 +342,8 @@ void StatesEditorView::resetDefaultState() return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); try { if (rootModelNode().hasProperty("state")) @@ -365,8 +365,8 @@ void StatesEditorView::setAnnotation(int internalNodeId) return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -395,8 +395,8 @@ void StatesEditorView::removeAnnotation(int internalNodeId) return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -517,8 +517,8 @@ void StatesEditorView::variantPropertiesChanged(const QList &pr return; m_block = true; - auto guard = [this]() { m_block = false; }; - QScopeGuard lock(guard); + auto guard = [this](int* p) { m_block = false; delete p; }; + std::unique_ptr scopeGuard(new int, guard); for (const VariantProperty &property : propertyList) { if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))