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_server.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_server.erl')
-rw-r--r-- | lib/wx/src/wxe_server.erl | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/lib/wx/src/wxe_server.erl b/lib/wx/src/wxe_server.erl index cc253b1143..ae9440f890 100644 --- a/lib/wx/src/wxe_server.erl +++ b/lib/wx/src/wxe_server.erl @@ -352,25 +352,8 @@ handle_disconnect(Object, Evh = #evh{cb=Fun}, From, State0 = #state{users=Users0, cb=Callbacks}) -> #user{events=Evs0} = gb_trees:get(From, Users0), FunId = gb_trees:lookup(Fun, Callbacks), - case find_handler(Evs0, Object, Evh#evh{cb=FunId}) of - [] -> - {reply, false, State0}; - Handlers -> - case disconnect(Object,Handlers) of - #evh{} -> {reply, true, State0}; - Result -> {reply, Result, State0} - end - end. - -disconnect(Object,[Ev|Evs]) -> - try wxEvtHandler:disconnect_impl(Object,Ev) of - true -> Ev; - false -> disconnect(Object, Evs); - Error -> Error - catch _:_ -> - false - end; -disconnect(_, []) -> false. + Handlers = find_handler(Evs0, Object, Evh#evh{cb=FunId}), + {reply, {try_in_order, Handlers}, State0}. find_handler([{Object,Evh}|Evs], Object, Match) -> case match_handler(Match, Evh) of |