[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.
This commit is contained in:
Felipe Magno de Almeida 2014-10-23 17:38:15 -02:00
parent 8004a794b1
commit 7acdf2b1dd
2 changed files with 7 additions and 1 deletions

View File

@ -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;
}
};

View File

@ -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);
}