diff options
author | Gary Li <gary.li1@uwaterloo.ca> | 2022-10-16 20:43:38 -0400 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-12-24 15:38:01 +0000 |
commit | 6885fb0163ca8f232e3230b39e5bbeabb3d2d5db (patch) | |
tree | 97004cf8bc66ac01441fffc76433464f449868b7 /src/nautilus-progress-persistence-handler.c | |
parent | 166ad014f38478b468da41cf45a842a8329bf2b9 (diff) | |
download | nautilus-6885fb0163ca8f232e3230b39e5bbeabb3d2d5db.tar.gz |
progress-persistence-handler: Ensure we release application
We wait for ::finished to release the application hold.
NautilusProgressInfo emits this signal in a idle callback. But if it
gets destroyed in the meantime, the idle source is removed. As a
result, the ::finish signal never gets emitted and we keep holding the
application forever.
So, keep it alive while we wait for the ::finished signal.
Diffstat (limited to 'src/nautilus-progress-persistence-handler.c')
-rw-r--r-- | src/nautilus-progress-persistence-handler.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nautilus-progress-persistence-handler.c b/src/nautilus-progress-persistence-handler.c index b10795d3e..193e67c6b 100644 --- a/src/nautilus-progress-persistence-handler.c +++ b/src/nautilus-progress-persistence-handler.c @@ -264,6 +264,8 @@ release_application (NautilusProgressInfo *info, { /* release the GApplication hold we acquired */ g_application_release (g_application_get_default ()); + /* Release reference aquired when the signal was connected. */ + g_object_unref (info); } static void @@ -274,6 +276,8 @@ progress_info_started_cb (NautilusProgressInfo *info, /* hold GApplication so we never quit while there's an operation pending */ g_application_hold (g_application_get_default ()); + /* Hold a ref to keep the info alive until we get the ::finished signal. */ + g_object_ref (info); g_signal_connect (info, "finished", G_CALLBACK (release_application), self); |