From a58e1893e9f7627aa6abbb18bb9b513b76390bf2 Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Tue, 2 Apr 2013 09:39:54 -0700 Subject: [PATCH] efl: add autodel option to EvasObject 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 --- src/efl/evasobject.cpp | 5 +++-- src/efl/evasobject.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/efl/evasobject.cpp b/src/efl/evasobject.cpp index 16f0589..cfee2e5 100644 --- a/src/efl/evasobject.cpp +++ b/src/efl/evasobject.cpp @@ -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_); } diff --git a/src/efl/evasobject.h b/src/efl/evasobject.h index b85bb9f..e2214de 100644 --- a/src/efl/evasobject.h +++ b/src/efl/evasobject.h @@ -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 -- 2.7.4