[glib/wip/fix-handler-leak] gsignal: Plug g_signal_connect_object leak




commit 70754b832a39f5e91be2310a08ee88844ac3ac6c
Author: Ray Strode <rstrode redhat com>
Date:   Tue Oct 13 09:24:02 2020 -0400

    gsignal: Plug g_signal_connect_object leak
    
    commit 916297be799ee001b4a214cc52c3b960bb0b5deb added a hash table
    to provide constant time lookups of signal handlers.
    
    Unfortunately, that commit neglected to remove handlers from the list
    that were disconnected implicitly from g_signal_connect_object calls.
    
    This commit addresses that bug by changing the closure invalidate
    handler associated with the signal connection to properly remove the
    handler from the hash table.

 gobject/gsignal.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index ebf5b3c1c..41599eb0d 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -3916,6 +3916,7 @@ invalid_closure_notify (gpointer  instance,
   g_assert (handler != NULL);
   g_assert (handler->closure == closure);
 
+  g_hash_table_remove (g_handlers, handler);
   handler->sequential_number = 0;
   handler->block_count = 1;
   handler_unref_R (signal_id, instance, handler);


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