aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/test/wx_basic_SUITE.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2013-12-20 09:20:22 +0100
committerDan Gudmundsson <[email protected]>2014-01-14 13:26:53 +0100
commit74f6d6d74f7a3be5aece37a0b419e40d96e036d4 (patch)
tree73ffc54f3b8b9b827f6f2a9aedd46b566dce7ffa /lib/wx/test/wx_basic_SUITE.erl
parent3f9b80b1e635f3b5f39bd7380b3bd777ebd98338 (diff)
downloadotp-74f6d6d74f7a3be5aece37a0b419e40d96e036d4.tar.gz
otp-74f6d6d74f7a3be5aece37a0b419e40d96e036d4.tar.bz2
otp-74f6d6d74f7a3be5aece37a0b419e40d96e036d4.zip
wx: Fix crash when garbage collect event handlers (debugger caused seg fault)
wxStyledTextCtrl had no wrapper class so, because it was not detected that it had virtual destructors, thus references to it was not cleaned up on destruction. When a process dies and wx cleans up the event handlers access was made to the deleted object and caused a seg fault. Added a testcase which I thought could provoke the bug but didn't.
Diffstat (limited to 'lib/wx/test/wx_basic_SUITE.erl')
-rw-r--r--lib/wx/test/wx_basic_SUITE.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl
index d55a037599..c5b0927bf3 100644
--- a/lib/wx/test/wx_basic_SUITE.erl
+++ b/lib/wx/test/wx_basic_SUITE.erl
@@ -324,7 +324,18 @@ data_types(_Config) ->
wx_object(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
wx_object(Config) ->
wx:new(),
- Frame = ?mt(wxFrame, wx_obj_test:start([])),
+ Me = self(),
+ Init = fun() ->
+ Frame = wxFrame:new(wx:null(), ?wxID_ANY, "Test wx_object", [{size, {500, 400}}]),
+ Sz = wxBoxSizer:new(?wxHORIZONTAL),
+ Panel = wxPanel:new(Frame),
+ wxSizer:add(Sz, Panel, [{flag, ?wxEXPAND}, {proportion, 1}]),
+ wxPanel:connect(Panel, size, [{skip, true}]),
+ wxPanel:connect(Panel, paint, [callback, {userData, Me}]),
+ wxWindow:show(Frame),
+ {Frame, {Frame, Panel}}
+ end,
+ Frame = ?mt(wxFrame, wx_obj_test:start([{init, Init}])),
timer:sleep(500),
?m(ok, check_events(flush())),