aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wxe_master.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2017-03-21 11:59:14 +0100
committerDan Gudmundsson <[email protected]>2017-04-06 15:45:06 +0200
commitb901918e7616dd346bfeb3e3c22be608a27f8da4 (patch)
tree76f03bc8142886b8d2995fcbc4c63fe8521d6509 /lib/wx/src/wxe_master.erl
parent7504aef08abb050d5c3d56f77704d21e15a85b62 (diff)
downloadotp-b901918e7616dd346bfeb3e3c22be608a27f8da4.tar.gz
otp-b901918e7616dd346bfeb3e3c22be608a27f8da4.tar.bz2
otp-b901918e7616dd346bfeb3e3c22be608a27f8da4.zip
Avoid livelock in driver when batching commands
With a bad timing in wx:batch() the driver could get stuck handling commands without ever checking for gui events. Avoid that by exiting loop after the driver have done cond_wait a couple of times.
Diffstat (limited to 'lib/wx/src/wxe_master.erl')
-rw-r--r--lib/wx/src/wxe_master.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/wx/src/wxe_master.erl b/lib/wx/src/wxe_master.erl
index e17a3327ac..913bf4d41b 100644
--- a/lib/wx/src/wxe_master.erl
+++ b/lib/wx/src/wxe_master.erl
@@ -82,8 +82,14 @@ init_port(SilentStart) ->
%% Initalizes the opengl library
%%--------------------------------------------------------------------
init_opengl() ->
- GLLib = wxe_util:wxgl_dl(),
- wxe_util:call(?WXE_INIT_OPENGL, <<(list_to_binary(GLLib))/binary, 0:8>>).
+ case get(wx_init_opengl) of
+ true -> {ok, "already initialized"};
+ _ ->
+ GLLib = wxe_util:wxgl_dl(),
+ Res = wxe_util:call(?WXE_INIT_OPENGL, <<(list_to_binary(GLLib))/binary, 0:8>>),
+ element(1, Res) =:= ok andalso put(wx_init_opengl, true),
+ Res
+ end.
%%--------------------------------------------------------------------
%% Fetch early messages, hack to get start up args on mac