[epiphany/mcatanzaro/ephy-session: 14/17] session: hold a reference until save thread finishes




commit 6e791d2bbde3d00b62eb44a89d4aa337fc692765
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Feb 24 11:28:30 2021 -0600

    session: hold a reference until save thread finishes
    
    This is not strictly needed, because currently EphyShell holds a
    reference to the EphySession, and we guarantee it stays alive by calling
    g_application_hold(). But let's be robust here in case that ever
    changes.

 src/ephy-session.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index dfa2ed40a..eeaa0760c 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -847,6 +847,7 @@ save_session_in_thread_finished_cb (GObject      *source_object,
                                     GAsyncResult *res,
                                     gpointer      user_data)
 {
+  g_object_unref (EPHY_SESSION (source_object));
   g_application_release (G_APPLICATION (ephy_shell_get_default ()));
 }
 
@@ -1018,6 +1019,8 @@ ephy_session_save_timeout_cb (EphySession *session)
   }
 
   g_application_hold (G_APPLICATION (ephy_shell_get_default ()));
+  g_object_ref (session);
+
   task = g_task_new (session, NULL, save_session_in_thread_finished_cb, NULL);
   g_task_set_task_data (task, data, (GDestroyNotify)save_data_free);
   g_task_run_in_thread (task, save_session_sync);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]