diff options
author | Dan Gudmundsson <[email protected]> | 2019-01-25 08:38:33 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2019-01-25 09:48:48 +0100 |
commit | d7805acb99f2b7ccd97541d189f6494966564d98 (patch) | |
tree | 4ef468ddf69cac6d3a2497fb369e078e43837c51 /lib/wx | |
parent | f180ccc75a7d2cef6b469d2e4a737cffbef7c951 (diff) | |
download | otp-d7805acb99f2b7ccd97541d189f6494966564d98.tar.gz otp-d7805acb99f2b7ccd97541d189f6494966564d98.tar.bz2 otp-d7805acb99f2b7ccd97541d189f6494966564d98.zip |
Fix showModal crash on Mojave
Invoking wxDialog:showModal could cause a seg-fault on Mojave
if invoked from inside event callback.
Which could happen when wx dispatch commands inside send_event.
Wx dispatches commands inside send_event because some events
will not return to idle mode (on Windows) until mouse is released.
These events are (at least) wxSize and wxMove according to previous
commits.
Solved by only dispatching commands for those events.
Another solution might be to ifdef the code to only do it on windows
or not do it on the Mac.
Diffstat (limited to 'lib/wx')
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 6 | ||||
-rw-r--r-- | lib/wx/c_src/gen/wxe_events.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index a29172032b..c6f2534380 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -1332,8 +1332,10 @@ encode_events(Evs) -> w(" } else {~n"), w(" send_res = rt.send();~n"), w(" if(cb->skip) event->Skip();~n"), - #class{id=MouseId} = lists:keyfind("wxMouseEvent", #class.name, Evs), - w(" if(app->recurse_level < 1 && Etype->cID != ~p) {~n", [MouseId]), + #class{id=SizeId} = lists:keyfind("wxSizeEvent", #class.name, Evs), + #class{id=MoveId} = lists:keyfind("wxMoveEvent", #class.name, Evs), + w(" if(app->recurse_level < 1 && (Etype->cID == ~w || Etype->cID == ~w)) {~n", + [SizeId, MoveId]), w(" app->recurse_level++;~n"), w(" app->dispatch_cmds();~n"), w(" app->recurse_level--;~n"), diff --git a/lib/wx/c_src/gen/wxe_events.cpp b/lib/wx/c_src/gen/wxe_events.cpp index 45da18f7c7..8c3283a670 100644 --- a/lib/wx/c_src/gen/wxe_events.cpp +++ b/lib/wx/c_src/gen/wxe_events.cpp @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2008-2018. All Rights Reserved. + * Copyright Ericsson AB 2008-2019. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -910,7 +910,7 @@ case 238: {// wxDropFilesEvent } else { send_res = rt.send(); if(cb->skip) event->Skip(); - if(app->recurse_level < 1 && Etype->cID != 168) { + if(app->recurse_level < 1 && (Etype->cID == 171 || Etype->cID == 172)) { app->recurse_level++; app->dispatch_cmds(); app->recurse_level--; |