[gjs: 7/8] object: Avoid segfault in debug mode



commit 3893d40f116d634d2c3e05f2175a46fb59163326
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Jun 1 00:06:57 2018 -0700

    object: Avoid segfault in debug mode
    
    This null pointer access could only happen when debug logging was turned
    on, but nonetheless it can be avoided easily.

 gi/object.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index cd2ed5a9..066281b0 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1432,7 +1432,8 @@ update_heap_wrapper_weak_pointers(JSContext     *cx,
 {
     gjs_debug_lifecycle(GJS_DEBUG_GOBJECT, "Weak pointer update callback, "
                         "%zu wrapped GObject(s) to examine",
-                        wrapped_gobject_list->instance_link.size());
+                        wrapped_gobject_list ?
+                            wrapped_gobject_list->instance_link.size() : 0);
 
     std::vector<ObjectInstance *> to_be_disassociated;
     ObjectInstance *priv = wrapped_gobject_list;


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