[epiphany/mcatanzaro/session: 2/2] session: remove user data from task to workaround glib bug




commit 5574a207566d133ffdf7c4fd5baec207c17dd1af
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Apr 27 10:01:44 2021 -0500

    session: remove user data from task to workaround glib bug
    
    GTask is destroying our user data on the secondary thread instead of the
    main thread, as required, causing UI process crashes. This is a
    workaround for glib#1346.

 src/ephy-session.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index a8767a759..84da2c1e1 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -823,6 +823,12 @@ save_session_in_thread_finished_cb (GObject      *source_object,
 {
   g_object_unref (EPHY_SESSION (source_object));
   g_application_release (G_APPLICATION (ephy_shell_get_default ()));
+
+  /* FIXME: this is a workaround for https://gitlab.gnome.org/GNOME/glib/-/issues/1346.
+   * After this GLib issue is fixed, we should instead pass save_data_free() as the
+   * GDestroyNotify parameter to g_task_set_task_data().
+   */
+  save_data_free (g_task_get_task_data (G_TASK (res)));
 }
 
 static gboolean
@@ -999,7 +1005,7 @@ ephy_session_save_timeout_cb (EphySession *session)
   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_set_task_data (task, data, NULL);
   g_task_run_in_thread (task, save_session_sync);
   g_object_unref (task);
 


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