diff options
author | Dan Gudmundsson <[email protected]> | 2015-07-07 10:38:38 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2015-07-07 10:38:38 +0200 |
commit | fcbc24440945a13b379b2b6135599c982bf8bdf0 (patch) | |
tree | 5c04db3494dfe5c196ab291da7bb2dcddadcf101 /lib/wx/test | |
parent | 70cb9432dc03ac9435b2c8c5fe2e8fd0608015dc (diff) | |
download | otp-fcbc24440945a13b379b2b6135599c982bf8bdf0.tar.gz otp-fcbc24440945a13b379b2b6135599c982bf8bdf0.tar.bz2 otp-fcbc24440945a13b379b2b6135599c982bf8bdf0.zip |
wx: Add event callback fastpath
Avoids spawn but can deadlock
Diffstat (limited to 'lib/wx/test')
-rw-r--r-- | lib/wx/test/wx_event_SUITE.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl index 2d6f7b6aaa..7e71d6ca69 100644 --- a/lib/wx/test/wx_event_SUITE.erl +++ b/lib/wx/test/wx_event_SUITE.erl @@ -78,7 +78,6 @@ connect(Config) -> Tester ! {got_size, UserD} end, - ?m(ok, wxFrame:connect(Frame, size)), ?m(ok, wxEvtHandler:connect(Panel, size,[{skip, true},{userData, panel}])), ?m(ok, wxEvtHandler:connect(Panel, size,[{callback,CB},{userData, panel}])), @@ -91,12 +90,16 @@ connect(Config) -> ?m(ok, wxWindow:connect(Window, size,[{callback,CB},{userData, window}])), ?m(ok, wxWindow:connect(Window, size,[{skip,true},{userData, window}])), + %% For trivial side effect free callbacks, can deadlock easily otherwise + CB1 = fun(_,_) -> Tester ! {got_size, nospawn_cb} end, + ?m(ok, wxWindow:connect(Frame, size, [{callback,{nospawn, CB1}}])), + ?m(ok, wxFrame:connect(Frame, size, [{skip, true}])), ?m(true, wxFrame:show(Frame)), wxWindow:setSize(Panel, {200,100}), wxWindow:setSize(Window, {200,100}), - get_size_messages(Frame, [frame, panel_cb, window_cb, window]), + get_size_messages(Frame, [frame, panel_cb, window_cb, window, nospawn_cb]), wx_test_lib:wx_destroy(Frame, Config). @@ -115,7 +118,9 @@ get_size_messages(Frame, Msgs) -> ?m(false, lists:member(window, Msgs)), get_size_messages(Frame, lists:delete(window_cb, Msgs)); {got_size,panel} -> - get_size_messages(Frame, lists:delete(panel_cb, Msgs)); + get_size_messages(Frame, lists:delete(panel_cb, Msgs)); + {got_size,nospawn_cb} -> + get_size_messages(Frame, lists:delete(nospawn_cb, Msgs)); Other -> ?error("Got unexpected msg ~p ~p~n", [Other,Msgs]) after 1000 -> |