From 43bf516d1052b7bcba72e5b0d6ae33352040c2f4 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 22 Jul 2022 15:23:04 +0200 Subject: [PATCH] QmlDesigner: Catch exception that leaves the notifer No exception should ever leave the view and it should be caught locally. If this still happens we should catch it and show an error message. Otherwise we risk throwing a second exception when rewinding, if the changes came from the text editor. Catching and showing an error message should never do harm. Change-Id: If275ed1179e4fa4245fef3df4dbc8d144a1588d3 Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/designercore/model/model.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index 5fd4dece8d4..d2277dec3ae 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -406,8 +406,12 @@ void ModelPrivate::notifyNodeInstanceViewLast(Callable call) } for (const QPointer &view : enabledViews()) { - if (!view->isBlockingNotifications()) - call(view.data()); + try { + if (!view->isBlockingNotifications()) + call(view.data()); + } catch (const Exception &e) { + e.showException(tr("Exception thrown by view %1.").arg(view->widgetInfo().tabName)); + } } if (nodeInstanceView() && !nodeInstanceView()->isBlockingNotifications())