[gjs] value: Pass NULL vp array if no closure arguments



commit e329af89967f05fa793c69e684b946c06eb9866b
Author: Philip Chimento <philip endlessm com>
Date:   Thu Nov 10 13:36:52 2016 -0800

    value: Pass NULL vp array if no closure arguments
    
    This used to work with an unrooted JS::Value* vp array, but now that we
    are using JS::AutoValueVector we can't index argv[0] if the size of the
    vector is 0. Pass NULL instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742249

 gi/value.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gi/value.cpp b/gi/value.cpp
index bb27e1c..953c5c2 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -274,7 +274,9 @@ closure_marshal(GClosure        *closure,
         if (type_info_for[i])
             g_base_info_unref((GIBaseInfo *)type_info_for[i]);
 
-    gjs_closure_invoke(closure, argv_index, &argv[0], &rval);
+    gjs_closure_invoke(closure, argv_index,
+                       argv_index > 0 ? &argv[0] : NULL,
+                       &rval);
 
     if (return_value != NULL) {
         if (rval.isUndefined()) {


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