diff options
author | Dan Gudmundsson <[email protected]> | 2015-12-01 16:43:08 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2015-12-01 16:43:08 +0100 |
commit | f0ab82279fa6fc7c91d9b3c193d1890b7c83e39b (patch) | |
tree | 3976393a55398e7ba60e853529c3e8c8b24fa765 /lib/wx/src/wxe_util.erl | |
parent | 617387025b698c7c7b1d102e35234b2c65dda335 (diff) | |
download | otp-f0ab82279fa6fc7c91d9b3c193d1890b7c83e39b.tar.gz otp-f0ab82279fa6fc7c91d9b3c193d1890b7c83e39b.tar.bz2 otp-f0ab82279fa6fc7c91d9b3c193d1890b7c83e39b.zip |
wx: Remove call to disconnect_impl from server
The server might wait for the result of a call to disconnect_impl
which can now be delayed, that might cause a callback to never be
invoked and thus hang the driver thread.
To avoid that dispatch the disconnect_impl call from user process
instead of server.
Diffstat (limited to 'lib/wx/src/wxe_util.erl')
-rw-r--r-- | lib/wx/src/wxe_util.erl | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/wx/src/wxe_util.erl b/lib/wx/src/wxe_util.erl index 1983e6783a..398ceddd4f 100644 --- a/lib/wx/src/wxe_util.erl +++ b/lib/wx/src/wxe_util.erl @@ -127,8 +127,21 @@ connect_cb(Object,EvData0 = #evh{cb=Callback}) -> disconnect_cb(Object,EvData) -> Server = (wx:get_env())#wx_env.sv, - gen_server:call(Server, {disconnect_cb,Object,EvData}, infinity). - + {try_in_order, Handlers} = + gen_server:call(Server, {disconnect_cb,Object,EvData}, infinity), + disconnect(Object, Handlers). + +disconnect(Object,[Ev|Evs]) -> + try wxEvtHandler:disconnect_impl(Object,Ev) of + true -> true; + false -> disconnect(Object, Evs); + Error -> Error + catch _:_ -> + false + end; +disconnect(_, []) -> false. + + debug_cast(1, Op, _Args, _Port) -> check_previous(), case ets:lookup(wx_debug_info,Op) of |