diff options
author | Sverker Eriksson <[email protected]> | 2016-03-08 14:46:09 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-03-08 14:46:09 +0100 |
commit | 7ba125fafa1da21d8780bcdae97f1ef56fb6a39a (patch) | |
tree | 671891684d94d78211f501371187bb2b425bcdaa /lib/wx/src/wxe_server.erl | |
parent | 2dc84032fd2a957b1625aba9bbcea9cbc04aa0df (diff) | |
parent | 652b67ba8d15ff415a8f30034bd9eb03a9c2b8ca (diff) | |
download | otp-7ba125fafa1da21d8780bcdae97f1ef56fb6a39a.tar.gz otp-7ba125fafa1da21d8780bcdae97f1ef56fb6a39a.tar.bz2 otp-7ba125fafa1da21d8780bcdae97f1ef56fb6a39a.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/wx/src/wxe_server.erl')
-rw-r--r-- | lib/wx/src/wxe_server.erl | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/wx/src/wxe_server.erl b/lib/wx/src/wxe_server.erl index ae9440f890..693a008e3d 100644 --- a/lib/wx/src/wxe_server.erl +++ b/lib/wx/src/wxe_server.erl @@ -272,7 +272,7 @@ invoke_callback(Pid, Ev, Ref) -> wx:set_env(Env), wxe_util:cast(?WXE_CB_START, <<>>), try - case get_wx_object_state(Pid) of + case get_wx_object_state(Pid, 5) of ignore -> %% Ignore early events wxEvent:skip(Ref); @@ -307,16 +307,24 @@ invoke_callback_fun(Fun) -> wxe_util:cast(?WXE_CB_RETURN, Res). -get_wx_object_state(Pid) -> +get_wx_object_state(Pid, N) when N > 0 -> case process_info(Pid, dictionary) of {dictionary, Dict} -> case lists:keysearch('_wx_object_',1,Dict) of - {value, {'_wx_object_', {_Mod, '_wx_init_'}}} -> ignore; - {value, {'_wx_object_', Value}} -> Value; - _ -> ignore + {value, {'_wx_object_', {_Mod, '_wx_init_'}}} -> + timer:sleep(50), + get_wx_object_state(Pid, N-1); + {value, {'_wx_object_', Value}} -> + Value; + _ -> + ignore end; - _ -> ignore - end. + _ -> + ignore + end; +get_wx_object_state(_, _) -> + ignore. + attach_fun(Fun, S = #state{cb=CB,cb_cnt=Next}) -> case gb_trees:lookup(Fun,CB) of |