efl: add autodel option to EvasObject
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 2 Apr 2013 16:39:54 +0000 (09:39 -0700)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 2 Apr 2013 16:39:54 +0000 (09:39 -0700)
By passing autodel=false to class EvasObject, this allows us to wrap
an Evas_Object* where the underlying pointer lifetime is managed by
some other internal object, hence telling the EvasObject instance to
avoid deleting the underlying pointer when the EvasObject itself is
destroyed.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/efl/evasobject.cpp
src/efl/evasobject.h

index 16f0589..cfee2e5 100644 (file)
@@ -1,15 +1,16 @@
 #include "evasobject.h"
 #include "common/test.h"
 
-EvasObject::EvasObject(Evas_Object* o)
+EvasObject::EvasObject(Evas_Object* o, bool autodel)
        : obj_(o)
+       , autodel_(autodel)
 {
        return;
 }
 
 EvasObject::~EvasObject()
 {
-       if (obj_)
+       if (obj_ and autodel_)
        {
                evas_object_del(obj_);
        }
index b85bb9f..e2214de 100644 (file)
@@ -7,7 +7,7 @@
 class EvasObject
 {
 public:
-       EvasObject(Evas_Object* = NULL);
+       EvasObject(Evas_Object* = NULL, bool autodel = true);
 
        virtual ~EvasObject();
 
@@ -37,7 +37,7 @@ public:
 
 private:
        Evas_Object*    obj_;
-
+       bool            autodel_;
 };
 
 #endif