diff options
author | Vitor Sousa <vitorsousasilva@gmail.com> | 2015-01-26 15:49:16 -0200 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2015-04-14 01:06:57 -0300 |
commit | 5043dcb830e96aa11b04e3bebc935c1c4cc606f2 (patch) | |
tree | 169b8e4dbf17c1d249d50bdbf222cd322fe2c7a9 /src/bindings | |
parent | 3b441cdf4a83383f4cd55ca8569e8eb98d45868e (diff) | |
download | efl-5043dcb830e96aa11b04e3bebc935c1c4cc606f2.tar.gz |
eo_cxx: Fix signal_connection disconnect crash
Fixed crash when disconnecting event inside of its own event callback.
Instead of deleting the callback object immediately during disconnection
(which causes the callback to be freed), the deletion is now scheduled
for later (using ecore_main_loop_thread_safe_call_async).
Updated some Makefiles to proper include ecore now that it is used in
all event wrappers.
Added a unit test to verify crashes under these circumstances.
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/eo_cxx/eo_event.hh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bindings/eo_cxx/eo_event.hh b/src/bindings/eo_cxx/eo_event.hh index f3d2e516d7..44c66afcb6 100644 --- a/src/bindings/eo_cxx/eo_event.hh +++ b/src/bindings/eo_cxx/eo_event.hh @@ -7,6 +7,7 @@ #define EFL_CXX_EO_EVENT_HH #include <Eo.h> +#include <Ecore.h> #include <functional> #include <memory> @@ -95,7 +96,13 @@ struct _event_deleter void operator()() const { eo_do(_eo, ::eo_event_callback_del(_description, _cb, _data)); - delete _data; + ::ecore_main_loop_thread_safe_call_async(&_deleter_call, _data); + } + +private: + static void _deleter_call(void* data) + { + delete static_cast<F*>(data); } F* _data; |