Changeset View
Changeset View
Standalone View
Standalone View
files/0003-right-file-dialog-freeze-fix.patch
- This file was added.
| From 8ecc98eb0308def4749c059a7d1e82f5056e0d02 Mon Sep 17 00:00:00 2001 | |||||
| From: Ilya Fedin <fedin-ilja2010@ya.ru> | |||||
| Date: Mon, 12 Jul 2021 00:06:56 +0400 | |||||
| Subject: [PATCH] Right file dialog freeze fix | |||||
| The freezing is still happening if the service is not accessible | |||||
| --- | |||||
| .../platform/linux/linux_xdp_file_dialog.cpp | 22 +++++++------------ | |||||
| 1 file changed, 8 insertions(+), 14 deletions(-) | |||||
| diff --git a/Telegram/SourceFiles/platform/linux/linux_xdp_file_dialog.cpp b/Telegram/SourceFiles/platform/linux/linux_xdp_file_dialog.cpp | |||||
| index 47622c2d58b5..40810db2cb88 100644 | |||||
| --- a/Telegram/SourceFiles/platform/linux/linux_xdp_file_dialog.cpp | |||||
| +++ b/Telegram/SourceFiles/platform/linux/linux_xdp_file_dialog.cpp | |||||
| @@ -569,15 +569,16 @@ int XDPFileDialog::exec() { | |||||
| setAttribute(Qt::WA_ShowModal, true); | |||||
| setResult(0); | |||||
| + show(); | |||||
| + if (failedToOpen()) { | |||||
| + return result(); | |||||
| + } | |||||
| + | |||||
| + QPointer<QDialog> guard = this; | |||||
| + | |||||
| // HACK we have to avoid returning until we emit | |||||
| // that the dialog was accepted or rejected | |||||
| - const auto context = Glib::MainContext::create(); | |||||
| - const auto loop = Glib::MainLoop::create(context); | |||||
| - g_main_context_push_thread_default(context->gobj()); | |||||
| - const auto contextGuard = gsl::finally([&] { | |||||
| - g_main_context_pop_thread_default(context->gobj()); | |||||
| - }); | |||||
| - | |||||
| + const auto loop = Glib::MainLoop::create(); | |||||
| rpl::lifetime lifetime; | |||||
| accepted( | |||||
| @@ -590,13 +591,6 @@ int XDPFileDialog::exec() { | |||||
| loop->quit(); | |||||
| }, lifetime); | |||||
| - show(); | |||||
| - if (failedToOpen()) { | |||||
| - return result(); | |||||
| - } | |||||
| - | |||||
| - QPointer<QDialog> guard = this; | |||||
| - | |||||
| loop->run(); | |||||
| if (guard.isNull()) { | |||||
Copyright © 2015-2021 Solus Project. The Solus logo is Copyright © 2016-2021 Solus Project. All Rights Reserved.