[gjs/gnome-3-28] object: Avoid segfault in debug mode
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gjs/gnome-3-28] object: Avoid segfault in debug mode
- Date: Sat,  1 Dec 2018 20:59:53 +0000 (UTC)
commit 2a87c22d3c4a2db0f8ad6c2e9bfa060f4ee62e47
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 777df122..fe381ec3 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1325,7 +1325,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<GObject *> to_be_disassociated;
     ObjectInstance *priv = wrapped_gobject_list;
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]