diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2019-06-26 13:44:25 +0200 |
---|---|---|
committer | Bernd Weimer <bernd.weimer@pelagicore.com> | 2019-08-01 13:21:17 +0200 |
commit | 3adab135d7aa4c560d29d39964f3ba4afa5abf94 (patch) | |
tree | 04d7976904d030df0935e5a917582286765d4822 | |
parent | ecf00cd214a771799717d9f2b24c300d8c50cccc (diff) |
Fix crashes when trying to start blocked apps
Cherry-picked from dev: 6be19e2
Task-number: AUTOSUITE-1079
Change-Id: I11fb811af92d782815659ce41c50008f9b336a71
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index 370b45e3..b2745ecb 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -1039,7 +1039,12 @@ bool ApplicationManager::openUrl(const QString &urlStr) if (!apps.isEmpty()) { if (!isSignalConnected(QMetaMethod::fromSignal(&ApplicationManager::openUrlRequested))) { // If the System-UI does not react to the signal, then just use the first match. - startApplicationInternal(apps.constFirst(), urlStr, mimeTypeName); + try { + startApplicationInternal(apps.constFirst(), urlStr, mimeTypeName); + } catch (const Exception &e) { + qCWarning(LogSystem) << "openUrl for" << urlStr << "requested app" << apps.constFirst()->id() + << "which could not be started:" << e.errorString(); + } } else { ApplicationManagerPrivate::OpenUrlRequest req { QUuid::createUuid().toString(), @@ -1096,7 +1101,12 @@ void ApplicationManager::acknowledgeOpenUrlRequest(const QString &requestId, con for (auto it = d->openUrlRequests.begin(); it != d->openUrlRequests.end(); ++it) { if (it->requestId == requestId) { if (it->possibleAppIds.contains(appId)) { - startApplicationInternal(application(appId), it->urlStr, it->mimeTypeName); + try { + startApplicationInternal(application(appId), it->urlStr, it->mimeTypeName); + } catch (const Exception &e) { + qCWarning(LogSystem) << "acknowledgeOpenUrlRequest for" << it->urlStr << "requested app" + << appId << "which could not be started:" << e.errorString(); + } } else { qCWarning(LogSystem) << "acknowledgeOpenUrlRequest for" << it->urlStr << "requested app" << appId << "which is not one of the registered possibilities:" @@ -1374,7 +1384,7 @@ void ApplicationManager::startSingleAppAndQuitWhenStopped() AbstractApplication *app = d->apps[0]; - if (!startApplicationInternal(app)) { + if (!startApplication(app->id())) { QMetaObject::invokeMethod(qApp, "shutDown", Qt::DirectConnection, Q_ARG(int, 1)); } else { connect(this, &ApplicationManager::applicationRunStateChanged, [app](const QString &id, Am::RunState runState) { @@ -1657,7 +1667,7 @@ void ApplicationManager::addApplication(AbstractApplication *app) connect (&app->requests, &ApplicationRequests::startRequested, this, [this, app](const QString &documentUrl) { - startApplicationInternal(app, documentUrl); + startApplication(app->id(), documentUrl); }); connect (&app->requests, &ApplicationRequests::debugRequested, |