summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2021-02-24 11:28:30 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2021-04-04 20:56:47 +0000
commit4c550a23411bb22a2f18510830395467c0a9690f (patch)
tree628df095adc53ce0a10e2f650575ffc118766f6c
parente5acd5594d4be63cac40486a9a13f1b35c9f4eb0 (diff)
downloadepiphany-4c550a23411bb22a2f18510830395467c0a9690f.tar.gz
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.
-rw-r--r--src/ephy-session.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index fe86bc82a..b106e0b4e 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);