]> git.tokkee.org Git - inkscape.git/commitdiff

Code

log finalization of NRObjects
authormental <mental@users.sourceforge.net>
Mon, 1 May 2006 03:42:42 +0000 (03:42 +0000)
committermental <mental@users.sourceforge.net>
Mon, 1 May 2006 03:42:42 +0000 (03:42 +0000)
ChangeLog
src/libnr/nr-object.cpp

index ec057ee4c049ca823fb2b63ff1454b1be5ab09cd..84fc74a4d5618028bd45508f696c263f0367e28c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@
        * src/dialogs/inkscape-preferences.cpp: Moved 'compass like
     display of angles' from 'windows' to 'steps'.
 
+2006-04-30  MenTaLguY  <mental@rydia.net>
+
+       * src/libnr/nr-object.cpp:
+
+         log finalization of NRObjects
+
 2006-04-29  Jon Phillips  <jon@rejon.org>
 
        * src/dialogs/rdf.cpp: Updated cc licenses to 2.5 by default.
index b18685d11f5d405d4f1290d6d742fb68d962bc8f..feffbd884d2f97cccd3218d34874e9c99d1af52b 100644 (file)
 #include <string.h>
 #include <stdio.h>
 
+#include <typeinfo>
+
 #include <libnr/nr-macros.h>
 
 #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<Debug::Event::FINALIZERS> 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<NRObject *>(base);
+    Debug::EventTracker<FinalizerEvent> tracker(object);
     object->klass->finalize(object);
     object->~NRObject();
 }