mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Right file dialog freeze fix
The freezing is still happening if the service is not accessible
This commit is contained in:
parent
c53564cfdc
commit
8ecc98eb03
1 changed files with 8 additions and 14 deletions
|
@ -569,15 +569,16 @@ int XDPFileDialog::exec() {
|
||||||
setAttribute(Qt::WA_ShowModal, true);
|
setAttribute(Qt::WA_ShowModal, true);
|
||||||
setResult(0);
|
setResult(0);
|
||||||
|
|
||||||
|
show();
|
||||||
|
if (failedToOpen()) {
|
||||||
|
return result();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointer<QDialog> guard = this;
|
||||||
|
|
||||||
// HACK we have to avoid returning until we emit
|
// HACK we have to avoid returning until we emit
|
||||||
// that the dialog was accepted or rejected
|
// that the dialog was accepted or rejected
|
||||||
const auto context = Glib::MainContext::create();
|
const auto loop = Glib::MainLoop::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());
|
|
||||||
});
|
|
||||||
|
|
||||||
rpl::lifetime lifetime;
|
rpl::lifetime lifetime;
|
||||||
|
|
||||||
accepted(
|
accepted(
|
||||||
|
@ -590,13 +591,6 @@ int XDPFileDialog::exec() {
|
||||||
loop->quit();
|
loop->quit();
|
||||||
}, lifetime);
|
}, lifetime);
|
||||||
|
|
||||||
show();
|
|
||||||
if (failedToOpen()) {
|
|
||||||
return result();
|
|
||||||
}
|
|
||||||
|
|
||||||
QPointer<QDialog> guard = this;
|
|
||||||
|
|
||||||
loop->run();
|
loop->run();
|
||||||
|
|
||||||
if (guard.isNull()) {
|
if (guard.isNull()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue