[pygobject/pygobject-3-12] Do not leak info of destroy notify



commit 22951466aee024f6199963a4f300b36c8e61c418
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Mar 30 18:27:59 2014 +0200

    Do not leak info of destroy notify

 gi/pygi-closure.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index b803541..42692e9 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -712,21 +712,22 @@ static PyGICClosure*
 _pygi_destroy_notify_create (void)
 {
     if (!global_destroy_notify) {
-
-        PyGICClosure *destroy_notify = g_slice_new0 (PyGICClosure);
-        GIBaseInfo* glib_destroy_notify;
-
-        g_assert (destroy_notify);
+        GIBaseInfo *glib_destroy_notify;
+        PyGICClosure *destroy_notify;
 
         glib_destroy_notify = g_irepository_find_by_name (NULL, "GLib", "DestroyNotify");
         g_assert (glib_destroy_notify != NULL);
         g_assert (g_base_info_get_type (glib_destroy_notify) == GI_INFO_TYPE_CALLBACK);
 
+        destroy_notify = g_slice_new0 (PyGICClosure);
+
         destroy_notify->closure = g_callable_info_prepare_closure ( (GICallableInfo*) glib_destroy_notify,
                                                                     &destroy_notify->cif,
                                                                     _pygi_destroy_notify_callback_closure,
                                                                     NULL);
 
+        g_base_info_unref (glib_destroy_notify);
+
         global_destroy_notify = destroy_notify;
     }
 


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