aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wxe_server.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-03-08 08:57:40 +0100
committerDan Gudmundsson <[email protected]>2016-03-08 08:57:40 +0100
commit9bfbf4319a42be7572334b57c3e16864681c252c (patch)
tree24e81d691c2fe9e8d945415867239e2accc9e421 /lib/wx/src/wxe_server.erl
parent2a44ac37f487001b551c0103ed0b4c5ab4579ff1 (diff)
parentcd754f764825d71a5e5021c617a74d2dac211409 (diff)
downloadotp-9bfbf4319a42be7572334b57c3e16864681c252c.tar.gz
otp-9bfbf4319a42be7572334b57c3e16864681c252c.tar.bz2
otp-9bfbf4319a42be7572334b57c3e16864681c252c.zip
Merge remote-tracking branch 'origin/dgud/wx/bugs' into maint
* origin/dgud/wx/bugs: wx: Use wrapper classes where possible wx: Wait before throwing away early callbacks to wx_objects wx: Add wxWindow:SetTransparent and CanSetTransperant wx: Add wxWindow SetDoubleBuffered and IsDoubleBuffered from wxWidgets 3.0 wx: Remove http_util usage wx: Tiny optimization wx: Fix a crash with sending two binaries to command queue
Diffstat (limited to 'lib/wx/src/wxe_server.erl')
-rw-r--r--lib/wx/src/wxe_server.erl22
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