[gjs] object: Fix use of TRUE_HANDLED accumulation



commit 269173542ef5a50091438babd904dbe515774b7c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Sep 29 12:09:49 2014 -0600

    object: Fix use of TRUE_HANDLED accumulation
    
    We need to make sure that we look up the return type's GType properly
    here on the check.

 gi/object.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 2903a37..4d3b805 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2685,7 +2685,7 @@ gjs_signal_new(JSContext *cx,
     GSignalAccumulator accumulator;
     gint signal_id;
     guint i, n_parameters;
-    GType *params;
+    GType *params, return_type;
     JSBool ret;
 
     if (argc != 6)
@@ -2715,8 +2715,9 @@ gjs_signal_new(JSContext *cx,
         accumulator = NULL;
     }
 
-    if (accumulator == g_signal_accumulator_true_handled &&
-        JSVAL_TO_INT(argv[4]) != G_TYPE_BOOLEAN) {
+    return_type = gjs_gtype_get_actual_gtype(cx, JSVAL_TO_OBJECT(argv[4]));
+
+    if (accumulator == g_signal_accumulator_true_handled && return_type != G_TYPE_BOOLEAN) {
         gjs_throw (cx, "GObject.SignalAccumulator.TRUE_HANDLED can only be used with boolean signals");
         ret = JS_FALSE;
         goto out;
@@ -2748,7 +2749,7 @@ gjs_signal_new(JSContext *cx,
                               accumulator,
                               NULL, /* accu_data */
                               g_cclosure_marshal_generic,
-                              gjs_gtype_get_actual_gtype(cx, JSVAL_TO_OBJECT(argv[4])), /* return type */
+                              return_type, /* return type */
                               n_parameters,
                               params);
 


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