diff options
| author | MenTaLguY <mental@rydia.net> | 2006-04-29 03:59:24 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-04-29 03:59:24 +0000 |
| commit | caf6e4e511a3361a8e7ef733794506411de638a2 (patch) | |
| tree | 6290e3484f26bb28228d602f3c3756cb8c5d1f61 /src/sp-object.cpp | |
| parent | reset center on stamping (diff) | |
| download | inkscape-caf6e4e511a3361a8e7ef733794506411de638a2.tar.gz inkscape-caf6e4e511a3361a8e7ef733794506411de638a2.zip | |
make refcount logging a little more useful by including the relevent class name
(bzr r610)
Diffstat (limited to 'src/sp-object.cpp')
| -rw-r--r-- | src/sp-object.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
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<char> _object; + Inkscape::Util::ptr_shared<char> _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<RefEvent>(object, RefEvent::REF); - + Inkscape::Debug::EventTracker<RefEvent> 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<RefEvent>(object, RefEvent::UNREF); - + Inkscape::Debug::EventTracker<RefEvent> tracker(object, RefEvent::UNREF); g_object_unref(G_OBJECT(object)); - return NULL; } |
