[gnome-notes] note-obj: Fix a crash on finalize
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes] note-obj: Fix a crash on finalize
- Date: Wed, 4 Aug 2021 10:39:40 +0000 (UTC)
commit 82d822f8f0f99765cd02fec3dab71efe4717d447
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Wed Jul 14 13:17:52 2021 +0530
note-obj: Fix a crash on finalize
When finalized, the note is saved only after some timeout, by the time
the note-obj shall be finalized. Fix the crash by adding a ref on note.
Also, clear the timeout signal handler on finalize.
src/libbiji/biji-note-obj.c | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index ac227902..e2aba32a 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -111,6 +111,7 @@ biji_note_obj_init (BijiNoteObj *self)
priv->timeout = biji_timeout_new ();
priv->save = g_signal_connect_swapped (priv->timeout, "timeout", G_CALLBACK (on_save_timeout), self);
+ g_object_set_data_full (G_OBJECT (priv->timeout), "note", g_object_ref (self), g_object_unref);
priv->labels = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
}
@@ -130,6 +131,8 @@ biji_note_obj_finalize (GObject *object)
BijiNoteObj *self = BIJI_NOTE_OBJ(object);
BijiNoteObjPrivate *priv = biji_note_obj_get_instance_private (self);
+ g_clear_signal_handler (&priv->save, priv->timeout);
+
if (priv->timeout)
g_object_unref (priv->timeout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]