summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2021-04-27 10:01:44 -0500
committerMarge Bot <marge-bot@gnome.org>2021-04-28 19:58:21 +0000
commitff8ecbf673cd25f8ed34d4ccb29cc5d3d13cd683 (patch)
treed639cebb07ee8a5d9c227d9bea150490985a1d90
parent97361ee6cb37741f8d28ff59aa3f9ee033ccdcb4 (diff)
downloadepiphany-ff8ecbf673cd25f8ed34d4ccb29cc5d3d13cd683.tar.gz
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. Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/954>
-rw-r--r--src/ephy-session.c8
1 files changed, 7 insertions, 1 deletions
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);