mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-08 10:35:15 +00:00
Use gsl::finally to pop thread context where appropriate
This commit is contained in:
@@ -574,6 +574,10 @@ int XDPFileDialog::exec() {
|
||||
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());
|
||||
});
|
||||
|
||||
rpl::lifetime lifetime;
|
||||
|
||||
accepted(
|
||||
@@ -594,7 +598,6 @@ int XDPFileDialog::exec() {
|
||||
QPointer<QDialog> guard = this;
|
||||
|
||||
loop->run();
|
||||
g_main_context_pop_thread_default(context->gobj());
|
||||
|
||||
if (guard.isNull()) {
|
||||
return QDialog::Rejected;
|
||||
|
Reference in New Issue
Block a user