[Libreoffice-commits] core.git: solenv/gdb

Stephan Bergmann sbergman at redhat.com
Mon Nov 10 06:29:39 PST 2014


 solenv/gdb/boost/smart_ptr.py |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit e639c4e2a43d4378af263f062b3ca06af8ed8c15
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Nov 10 15:29:11 2014 +0100

    Do not deref (potentially dangling) weak_ptr
    
    Change-Id: Ic9694aa8bd85fe0548b8f5fc5f52b4bbd6dce1cf

diff --git a/solenv/gdb/boost/smart_ptr.py b/solenv/gdb/boost/smart_ptr.py
index 6646e12..60d8827 100644
--- a/solenv/gdb/boost/smart_ptr.py
+++ b/solenv/gdb/boost/smart_ptr.py
@@ -41,6 +41,16 @@ class SmartPtrPrinter:
         else:
             return "empty %s" % (self.typename)
 
+class WeakPtrPrinter:
+    """Prints boost::weak_ptr instances"""
+
+    def __init__(self, typename, value):
+        self.typename = typename
+        self.value = value
+
+    def to_string(self):
+        value = self.value['px']
+        return "%s %s" % (self.typename, value)
 
 printer = None
 
@@ -54,7 +64,7 @@ def build_pretty_printers():
 
     printer.add('boost::shared_ptr', SmartPtrPrinter)
     # printer.add('boost::shared_array', SmartPtrPrinter)
-    printer.add('boost::weak_ptr', SmartPtrPrinter)
+    printer.add('boost::weak_ptr', WeakPtrPrinter)
     printer.add('boost::scoped_ptr', SmartPtrPrinter)
     # printer.add('boost::scoped_array', SmartPtrPrinter)
 


More information about the Libreoffice-commits mailing list