QmlDesigner: Avoid throwing in the destructor of transactions

Since C++11 destructors do not throw by default.

Change-Id: Ic6403704587999464011fcaa1f9ac7df3e4ee49d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2016-12-21 14:28:39 +01:00
parent 8f74cc3b7c
commit d4aa4523b7
4 changed files with 10 additions and 0 deletions

View File

@@ -230,6 +230,7 @@ void raise(const SelectionContext &selectionState)
node.setVariantProperty("z", z);
}
}
transaction.commit();
} catch (const RewritingException &e) { //better save then sorry
e.showException();
}
@@ -251,6 +252,7 @@ void lower(const SelectionContext &selectionState)
node.setVariantProperty("z", z);
}
}
transaction.commit();
} catch (const RewritingException &e) { //better save then sorry
e.showException();
}
@@ -333,6 +335,7 @@ void resetPosition(const SelectionContext &selectionState)
node.removeProperty("x");
node.removeProperty("y");
}
transaction.commit();
} catch (const RewritingException &e) { //better save then sorry
e.showException();
}
@@ -663,6 +666,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
QmlObjectNode qmlObjectNode(modelNode);
qmlObjectNode.ensureAliasExport();
transaction.commit();
} catch (RewritingException &exception) { //better safe than sorry! There always might be cases where we fail
exception.showException();
}

View File

@@ -373,6 +373,7 @@ void DesignDocument::deleteSelected()
QmlObjectNode(node).destroy();
}
transaction.commit();
} catch (const RewritingException &e) {
e.showException();
}
@@ -536,6 +537,7 @@ void DesignDocument::paste()
}
view.setSelectedModelNodes(pastedNodeList);
transaction.commit();
} catch (const RewritingException &e) {
qWarning() << e.description(); //silent error
}
@@ -574,6 +576,7 @@ void DesignDocument::paste()
NodeMetaInfo::clearCache();
view.setSelectedModelNodes(QList<ModelNode>() << pastedNode);
transaction.commit();
} catch (const RewritingException &e) {
qWarning() << e.description(); //silent error
}

View File

@@ -717,6 +717,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProper
}
}
}
transaction.commit();
} catch (const RewritingException &exception) { //better safe than sorry! There always might be cases where we fail
exception.showException();
}

View File

@@ -188,6 +188,8 @@ void ModelMerger::replaceModel(const ModelNode &modelNode)
syncNodeProperties(rootNode, modelNode, idRenamingHash, view());
syncNodeListProperties(rootNode, modelNode, idRenamingHash, view());
m_view->changeRootNodeType(modelNode.type(), modelNode.majorVersion(), modelNode.minorVersion());
transaction.commit();
} catch (const RewritingException &e) {
qWarning() << e.description(); //silent error
}