diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp index aad9fe1676278..33b0ad780038e 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp @@ -12,21 +12,25 @@ For license and copyright information please follow this link: #include -#include -#include +#include + +using namespace gi::repository; namespace Platform { namespace File { void UnsafeOpenUrl(const QString &url) { - try { - if (Gio::AppInfo::launch_default_for_uri( + { + const auto result = Gio::AppInfo::launch_default_for_uri( url.toStdString(), - base::Platform::AppLaunchContext())) { + base::Platform::AppLaunchContext()); + + if (!result) { + LOG(("App Error: %1").arg( + QString::fromStdString(result.error().what()))); + } else if (*result) { return; } - } catch (const std::exception &e) { - LOG(("App Error: %1").arg(QString::fromStdString(e.what()))); } QDesktopServices::openUrl(url); @@ -45,14 +49,29 @@ bool UnsafeShowOpenWith(const QString &filepath) { } void UnsafeLaunch(const QString &filepath) { - try { - if (Gio::AppInfo::launch_default_for_uri( - Glib::filename_to_uri(filepath.toStdString()), - base::Platform::AppLaunchContext())) { - return; + if ([&] { + const auto filename = GLib::filename_to_uri(filepath.toStdString()); + if (!filename) { + LOG(("App Error: %1").arg( + QString::fromStdString(filename.error().what()))); + + return false; + } + + const auto result = Gio::AppInfo::launch_default_for_uri( + *filename, + base::Platform::AppLaunchContext()); + + if (!result) { + LOG(("App Error: %1").arg( + QString::fromStdString(result.error().what()))); + + return false; } - } catch (const std::exception &e) { - LOG(("App Error: %1").arg(QString::fromStdString(e.what()))); + + return *result; + }()) { + return; } if (UnsafeShowOpenWith(filepath)) { diff --git a/Telegram/lib_base b/Telegram/lib_base index efd052594db9f..609a9e69f2a69 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit efd052594db9f3d85a2fbcba76db6fdecf226597 +Subproject commit 609a9e69f2a69fea050e75cbe2b546b4aa1e4914 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 91d43ea4b50ef..0f25a9451012c 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 91d43ea4b50ef1e7df810ab1f14c49e044570734 +Subproject commit 0f25a9451012c7fba93777a009f3b5dcc0f1ca89 diff --git a/cmake b/cmake index 0620bb7b87a0e..d1c98b4c472c7 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 0620bb7b87a0ec9195151fd5eb0cf38656c1280b +Subproject commit d1c98b4c472c7b59c239006a06d7a784a60a347f