From 3680cfbf130eb9e17fa5a5b57435f1985e380ba8 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 1 May 2006 03:42:42 +0000 Subject: log finalization of NRObjects (bzr r644) --- src/libnr/nr-object.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/libnr/nr-object.cpp') diff --git a/src/libnr/nr-object.cpp b/src/libnr/nr-object.cpp index b18685d11..feffbd884 100644 --- a/src/libnr/nr-object.cpp +++ b/src/libnr/nr-object.cpp @@ -13,9 +13,15 @@ #include #include +#include + #include #include "nr-object.h" +#include "debug/event-tracker.h" +#include "debug/simple-event.h" +#include "util/share.h" +#include "util/format.h" unsigned int nr_emit_fail_warning(const gchar *file, unsigned int line, const gchar *method, const gchar *expr) { @@ -150,9 +156,25 @@ static void nr_class_tree_object_invoke_init(NRObjectClass *c, NRObject *object) namespace { +namespace Debug = Inkscape::Debug; +namespace Util = Inkscape::Util; + +typedef Debug::SimpleEvent BaseFinalizerEvent; + +class FinalizerEvent : public BaseFinalizerEvent { +public: + FinalizerEvent(NRObject *object) + : BaseFinalizerEvent(Util::share_static_string("nr-object-finalizer")) + { + _addProperty("object", Util::format("%p", object)); + _addProperty("class", Util::share_static_string(typeid(*object).name())); + } +}; + void finalize_object(void *base, void *) { NRObject *object = reinterpret_cast(base); + Debug::EventTracker tracker(object); object->klass->finalize(object); object->~NRObject(); } -- cgit v1.2.3