felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7acdf2b1ddc6ffe51fc30dfc4d6ddca6e60d1a91

commit 7acdf2b1ddc6ffe51fc30dfc4d6ddca6e60d1a91
Author: Felipe Magno de Almeida <[email protected]>
Date:   Thu Oct 23 17:38:15 2014 -0200

    [cxx] Fixed eina::value get for string
    
    The get function for string in eina::value wronfully was freeing the
    string returned from eina_value_get. Which crashed applications that
    used it.
---
 src/bindings/eina_cxx/eina_value.hh       | 1 -
 src/tests/eina_cxx/eina_cxx_test_value.cc | 7 +++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/bindings/eina_cxx/eina_value.hh 
b/src/bindings/eina_cxx/eina_value.hh
index fbf96e6..f66d5f9 100644
--- a/src/bindings/eina_cxx/eina_value.hh
+++ b/src/bindings/eina_cxx/eina_value.hh
@@ -269,7 +269,6 @@ struct _eina_value_traits<std::string>
     char* c_str;
     ::eina_value_get(v, &c_str);
     std::string r(c_str);
-    ::free(c_str);
     return r;
   }
 };
diff --git a/src/tests/eina_cxx/eina_cxx_test_value.cc 
b/src/tests/eina_cxx/eina_cxx_test_value.cc
index c095f85..61ccbed 100644
--- a/src/tests/eina_cxx/eina_cxx_test_value.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_value.cc
@@ -184,6 +184,12 @@ START_TEST(eina_cxx_value_copying)
 }
 END_TEST
 
+START_TEST(eina_cxx_value_temporaries)
+{
+  efl::eina::get<std::string>(efl::eina::value(std::string("Matroska")));
+}
+END_TEST
+
 void
 eina_test_value(TCase* tc)
 {
@@ -192,4 +198,5 @@ eina_test_value(TCase* tc)
   tcase_add_test(tc, eina_cxx_value_wrong_get);
   tcase_add_test(tc, eina_cxx_value_comparison_operators);
   tcase_add_test(tc, eina_cxx_value_copying);
+  tcase_add_test(tc, eina_cxx_value_temporaries);
 }

-- 


Reply via email to