diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-06-17 18:10:21 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:15:27 -0300 |
commit | 88a84ee6ae8cd12b2527576505f16774c9c542c1 (patch) | |
tree | 64449426c1b79c4647c9f94f09543d7eda4f046b /tests/libsample | |
parent | c3eb8bb198b7cbc43236b1edbf7afbf096d8b8f6 (diff) |
Fix refleak during the parent c++ object destruction.
Fixes bug #893.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'tests/libsample')
-rw-r--r-- | tests/libsample/objecttype.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h index a5abf7067..5cc029e85 100644 --- a/tests/libsample/objecttype.h +++ b/tests/libsample/objecttype.h @@ -107,6 +107,20 @@ public: void callVirtualCreateChild(); virtual ObjectType* createChild(ObjectType* parent); + //return a parent from C++ + ObjectType* getCppParent() { + if (!m_parent) { + ObjectType* parent = new ObjectType(); + setParent(parent); + } + return m_parent; + } + + void destroyCppParent() { + delete m_parent; + m_parent = 0; + } + private: ObjectType(const ObjectType&); ObjectType& operator=(const ObjectType&); |