From 3d4412ad1a346d80959cd78395703636d9127699 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 13 Apr 2020 11:21:25 +0200 Subject: mobile: don't call main loop for notifications once initialized Calling qApp->processEvents() in QMLManager::setNotificationText() caused crashes, because it could lead to the context-menu that initialized the call being deleted. Something that QML apparently doesn't like. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index a610b36cd..0e7e16ddb 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1710,7 +1710,12 @@ void QMLManager::setNotificationText(QString text) appendTextToLog(QStringLiteral("showProgress: ") + text); m_notificationText = text; emit notificationTextChanged(); - qApp->processEvents(); + // Once we're initialized, this may be called from signal context, notably when selecting an action from a context menu. + // Processing events may now cause the menu to be deleted. Deleting a QML object which sent a signal causes QML to quit the application. + // Therefore, don't process events once the application is started. + // During startup this is needed so that the notifications are shown. + if (!m_initialized) + qApp->processEvents(); } qreal QMLManager::lastDevicePixelRatio() -- cgit v1.2.3-70-g09d2