Bug 1298775 - Fix nullptr dereferencing. r=tbsaunde
authorWei-Cheng Pan <wpan@mozilla.com>
Wed, 31 Aug 2016 18:35:01 +0800
changeset 313151 074f9de56ac0420e644b2bab7cade77d736d67b9
parent 313150 4c154c6cbf4bfb274630731c750742e2405b2c3c
child 313152 4b1be484aab80b6029608e6a25002537f6690da7
push id30673
push usercbook@mozilla.com
push dateThu, 08 Sep 2016 10:01:33 +0000
treeherdermozilla-central@938ce16be25f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs1298775
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1298775 - Fix nullptr dereferencing. r=tbsaunde This is a follow up to fix nullptr printing. MozReview-Commit-ID: KDjBsHHiDxv
python/gdbpp/gdbpp/smartptr.py
--- a/python/gdbpp/gdbpp/smartptr.py
+++ b/python/gdbpp/gdbpp/smartptr.py
@@ -39,23 +39,25 @@ class smartptr_printer(object):
         else:
             type_name = str(self.value.dereference().dynamic_type.pointer())
 
         return '[(%s) %s]' % (type_name, str(self.value))
 
 @GeckoPrettyPrinter('mozilla::StyleSheetHandle::RefPtr', '^mozilla::HandleRefPtr<mozilla::StyleSheetHandle>$')
 class sheetptr_printer(object):
     def __init__(self, value):
-        self.value = value['mHandle']
-        if self.value and self.value['mPtr'] and self.value['mPtr']['mValue']:
-            self.value = self.value['mPtr']['mValue']
+        self.value = 0
+        if (value['mHandle'] and
+            value['mHandle']['mPtr'] and
+            value['mHandle']['mPtr']['mValue']):
+            self.value = int(value['mHandle']['mPtr']['mValue'])
 
     def to_string(self):
-        if not self.value:
-            type_name = str(self.value.type)
+        if self.value == 0:
+            type_name = 'mozilla::StyleSheet *'
             value = 0
         else:
             value = int(self.value)
             if value & 0x1:
                 value = value & ~0x1
                 type_name = 'mozilla::ServoStyleSheet *'
             else:
                 type_name = 'mozilla::CSSStyleSheet *'