[gjs] Handle destroy callbacks of type other than GDestroyNotify



commit 62cf04df5dbf097b3655bfda1909a759d378e9dc
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu May 6 17:39:22 2010 -0400

    Handle destroy callbacks of type other than GDestroyNotify
    
    It's not necessary that a destroy callback is literally of type
    GDestroyNotify - we can handle any 'void (*function) (void *)'
    
    So instead of checking against the type of the callback to
    see what to skip, look for a callback that was previously used as
    a GDestroyNotify for another callback.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617972

 gi/function.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index 98343f5..ad1b20b 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -896,8 +896,7 @@ init_cached_function_data (JSContext      *context,
             interface_info = g_type_info_get_interface(&type_info);
             interface_type = g_base_info_get_type(interface_info);
             if (interface_type == GI_INFO_TYPE_CALLBACK &&
-                !(strcmp(g_base_info_get_namespace( (GIBaseInfo*) interface_info), "GLib") == 0 &&
-                  strcmp(g_base_info_get_name( (GIBaseInfo*) interface_info), "DestroyNotify") == 0)) {
+                i != function->destroy_notify_index) {
                 if (function->callback_index != GJS_ARG_INDEX_INVALID) {
                     gjs_throw(context, "Function %s.%s has multiple callbacks, not supported",
                               g_base_info_get_namespace( (GIBaseInfo*) info),



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