[gnome-notes/bugfix/igaldino/warn-signal-no-handler] timeout: Fix warning about instance has no handler



commit 0e9f2ece3ba836d31ec4366ce2d4f55eebde335c
Author: Isaque Galdino <igaldino gmail com>
Date:   Mon Jun 22 22:31:49 2020 -0300

    timeout: Fix warning about instance has no handler
    
    GNOME Notes was throwing the following messages exiting:
    
    (bijiben:2): GLib-GObject-WARNING **: 22:19:12.256: ../gobject/gsignal.c
    :2731: instance '0x55b0fadfb100' has no handler with id '399'
    
    where instance was the address of the application.
    
    In order to fix that I added a signal connection check before
    disconneting it.

 src/libbiji/biji-timeout.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/libbiji/biji-timeout.c b/src/libbiji/biji-timeout.c
index a08158e..4176e6f 100644
--- a/src/libbiji/biji-timeout.c
+++ b/src/libbiji/biji-timeout.c
@@ -50,12 +50,13 @@ biji_timeout_init (BijiTimeout *self)
 static void
 biji_timeout_finalize (GObject *object)
 {
-  BijiTimeout *self = BIJI_TIMEOUT (object);
+  BijiTimeout  *self = BIJI_TIMEOUT (object);
+  GApplication *app  = g_application_get_default ();
 
   biji_timeout_cancel (self);
 
-  if (self->quit !=0 )
-    g_signal_handler_disconnect (g_application_get_default(), self->quit);
+  if (self->quit != 0 && g_signal_handler_is_connected (app, self->quit))
+    g_signal_handler_disconnect (app, self->quit);
 
   G_OBJECT_CLASS (biji_timeout_parent_class)->finalize (object);
 }


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