From caf6e4e511a3361a8e7ef733794506411de638a2 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Sat, 29 Apr 2006 03:59:24 +0000 Subject: make refcount logging a little more useful by including the relevent class name (bzr r610) --- src/sp-object.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/sp-object.cpp') diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 9068c4ba2..e7778dd08 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -246,7 +246,9 @@ public: enum Type { REF, UNREF }; RefEvent(SPObject *object, Type type) - : _object(stringify(object)), _refcount(G_OBJECT(object)->ref_count), + : _object(stringify(object)), + _class_name(Inkscape::Util::share_static_string(g_type_name(G_TYPE_FROM_INSTANCE(object)))), + _refcount(G_OBJECT(object)->ref_count), _type(type) {} @@ -259,13 +261,15 @@ public: return Inkscape::Util::share_static_string("sp-object-unref"); } } - unsigned propertyCount() const { return 2; } + unsigned propertyCount() const { return 3; } PropertyPair property(unsigned index) const { switch (index) { case 0: return PropertyPair("object", _object); case 1: - return PropertyPair("refcount", stringify( _type == REF ? _refcount + 1 : _refcount - 1 )); + return PropertyPair("class", _class_name); + case 2: + return PropertyPair("new-refcount", stringify( _type == REF ? _refcount + 1 : _refcount - 1 )); default: return PropertyPair(); } @@ -273,6 +277,7 @@ public: private: Inkscape::Util::ptr_shared _object; + Inkscape::Util::ptr_shared _class_name; unsigned _refcount; Type _type; }; @@ -293,11 +298,8 @@ sp_object_ref(SPObject *object, SPObject *owner) g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL); - Inkscape::Debug::EventTracker<> tracker; - tracker.set(object, RefEvent::REF); - + Inkscape::Debug::EventTracker tracker(object, RefEvent::REF); g_object_ref(G_OBJECT(object)); - return object; } @@ -316,11 +318,8 @@ sp_object_unref(SPObject *object, SPObject *owner) g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL); - Inkscape::Debug::EventTracker<> tracker; - tracker.set(object, RefEvent::UNREF); - + Inkscape::Debug::EventTracker tracker(object, RefEvent::UNREF); g_object_unref(G_OBJECT(object)); - return NULL; } -- cgit v1.2.3