From: Matthieu Gallien Date: Thu, 8 Dec 2022 09:58:58 +0000 (+0100) Subject: do not create GUI from a random thread and show error on real error X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~85^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2c94490b9c46aa17bf9f0f881042d85bc7dbe928;p=nextcloud-desktop.git do not create GUI from a random thread and show error on real error Signed-off-by: Matthieu Gallien --- diff --git a/src/gui/editlocallyjob.cpp b/src/gui/editlocallyjob.cpp index 1027243e3..69eccd62f 100644 --- a/src/gui/editlocallyjob.cpp +++ b/src/gui/editlocallyjob.cpp @@ -37,6 +37,7 @@ EditLocallyJob::EditLocallyJob(const QString &userId, , _relPath(relPath) , _token(token) { + connect(this, &EditLocallyJob::callShowError, this, &EditLocallyJob::showError, Qt::QueuedConnection); } void EditLocallyJob::startSetup() @@ -546,8 +547,8 @@ void EditLocallyJob::openFile() // from a separate thread, or, there will be a freeze. To avoid searching for a specific folder and checking // if the VFS is enabled - we just always call it from a separate thread. QtConcurrent::run([localFilePathUrl, this]() { - if (QDesktopServices::openUrl(localFilePathUrl)) { - showError(tr("Could not open %1").arg(_fileName), tr("Please try again.")); + if (!QDesktopServices::openUrl(localFilePathUrl)) { + emit callShowError(tr("Could not open %1").arg(_fileName), tr("Please try again.")); } Systray::instance()->destroyEditFileLocallyLoadingDialog(); diff --git a/src/gui/editlocallyjob.h b/src/gui/editlocallyjob.h index 158e0fc5d..645649246 100644 --- a/src/gui/editlocallyjob.h +++ b/src/gui/editlocallyjob.h @@ -46,7 +46,7 @@ signals: void setupFinished(); void error(const QString &message, const QString &informativeText); void finished(); - + void callShowError(const QString &message, const QString &informativeText); public slots: void startSetup(); void startEditLocally();