forked from enlightenment/efl
[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:
parent
8004a794b1
commit
7acdf2b1dd
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue