eolian-cxx: Release iterators
authorLauro Moura <lauromoura@expertisesolutions.com.br>
Mon, 30 Sep 2019 13:38:55 +0000 (15:38 +0200)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 30 Sep 2019 22:28:26 +0000 (07:28 +0900)
Summary:
When the iterators advanced, the CXX wrappers null'd them but did not
call eina_value_free.

ref T8280

Reviewers: q66, brunobelo, felipealmeida

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8280

Differential Revision: https://phab.enlightenment.org/D10238

src/bindings/cxx/eina_cxx/eina_iterator.hh

index 6fd9095..1a8fedd 100644 (file)
@@ -189,7 +189,10 @@ public:
     void* data;
     Eina_Bool r = ::eina_iterator_next(this->_iterator, &data);
     if(!r)
-      this->_iterator = 0;
+      {
+         ::eina_iterator_free(this->_iterator);
+         this->_iterator = 0;
+      }
     _value = static_cast<pointer>(data);
     return *this;
   }
@@ -267,7 +270,10 @@ public:
     void* data;
     Eina_Bool r = ::eina_iterator_next(this->_iterator, &data);
     if(!r)
-      this->_iterator = 0;
+      {
+         ::eina_iterator_free(this->_iterator);
+         this->_iterator = 0;
+      }
     _value = static_cast<pointer>(data);
     return *this;
   }