summaryrefslogtreecommitdiffstats
path: root/src/sp-object.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-04-01 21:50:52 +0000
committerMarkus Engel <markus.engel@tum.de>2013-04-01 21:50:52 +0000
commit7504b21ce73f7f2d3787ab5f363b5e5acc721a23 (patch)
tree9923f639e4c7862b40ffef2e3f21bec5b3be9f23 /src/sp-object.cpp
parentReplaced calls to g_object_(un)ref with sp_object_(un)ref. (diff)
downloadinkscape-7504b21ce73f7f2d3787ab5f363b5e5acc721a23.tar.gz
inkscape-7504b21ce73f7f2d3787ab5f363b5e5acc721a23.zip
Added experimental constructor to SPRect. Memory leaks because of non-virtual destructor.
(bzr r11608.1.66)
Diffstat (limited to 'src/sp-object.cpp')
-rw-r--r--src/sp-object.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 0ba74990e..66f9b5ab8 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -118,12 +118,9 @@ sp_object_class_init(SPObjectClass *klass)
object_class->finalize = sp_object_finalize;
}
-/**
- * Callback to initialize the SPObject object.
- */
-static void
-sp_object_init(SPObject *object)
-{
+SPObject::SPObject() {
+ SPObject* object = this;
+
debug("id=%x, typename=%s",object, g_type_name_from_instance((GTypeInstance*)object));
object->cobject = new CObject(object);
@@ -131,6 +128,12 @@ sp_object_init(SPObject *object)
new (&object->typeHierarchy) std::set<TypeInfo>();
object->typeHierarchy.insert(typeid(SPObject));
+ object->repr = NULL;
+ object->mflags = 0;
+ object->id = NULL;
+ object->cloned = 0;
+ object->uflags = 0;
+
object->hrefcount = 0;
object->_total_hrefcount = 0;
object->document = NULL;
@@ -160,6 +163,15 @@ sp_object_init(SPObject *object)
object->_default_label = NULL;
}
+/**
+ * Callback to initialize the SPObject object.
+ */
+static void
+sp_object_init(SPObject *object)
+{
+ new (object) SPObject();
+}
+
// CPPIFY: make pure virtual
void CObject::read_content() {
//throw;