aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/rewritertransaction.cpp
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2016-12-22 12:00:56 +0100
committerThomas Hartmann <thomas.hartmann@qt.io>2017-01-04 13:26:25 +0000
commit3d168b67cb66e737f4578bc01fd72c0ad3cf9063 (patch)
tree6685bbea751225abb5ef7e8ab081fce943710683 /src/plugins/qmldesigner/designercore/rewritertransaction.cpp
parentd4aa4523b7c25feec87ac94bedf27cb108d706bd (diff)
QmlDesigner: Do not throw in destructor of transaction
In C++ noexcept(true) is the default for destructors. Instead of poluting the code base with noexcept(false), we catch the exception inside the destructor of the transaction. Typically the application code does not anything special to handle the error, so showing the error message is good enough. If the application code wants to handle exceptions commit() has to be called instead of relying on RAAI. Change-Id: Ic73cacb197737698454eca9270d07fd897c97ca8 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/designercore/rewritertransaction.cpp')
-rw-r--r--src/plugins/qmldesigner/designercore/rewritertransaction.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/qmldesigner/designercore/rewritertransaction.cpp b/src/plugins/qmldesigner/designercore/rewritertransaction.cpp
index 755b667a06..841fc730e5 100644
--- a/src/plugins/qmldesigner/designercore/rewritertransaction.cpp
+++ b/src/plugins/qmldesigner/designercore/rewritertransaction.cpp
@@ -25,6 +25,7 @@
#include "rewritertransaction.h"
#include <abstractview.h>
+#include <rewritingexception.h>
#include <rewriterview.h>
#include <utils/qtcassert.h>
@@ -67,7 +68,12 @@ RewriterTransaction::RewriterTransaction(AbstractView *_view, const QByteArray &
RewriterTransaction::~RewriterTransaction()
{
- commit();
+ try {
+ commit();
+ } catch (const RewritingException &e) {
+ QTC_ASSERT(false, ;);
+ e.showException();
+ }
}
bool RewriterTransaction::isValid() const