diff options
author | Dan Gudmundsson <[email protected]> | 2013-10-30 16:46:54 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-10-30 16:46:54 +0100 |
commit | c054ac3d4df7fe8b2f58204e677f275bd8f0e60c (patch) | |
tree | 178e2dd83ca426d08d767be91a664b2bf6153e25 /lib/wx/test/wx_test_lib.erl | |
parent | 1d7472911e14e4885c9111aa21fc201c397be20f (diff) | |
download | otp-c054ac3d4df7fe8b2f58204e677f275bd8f0e60c.tar.gz otp-c054ac3d4df7fe8b2f58204e677f275bd8f0e60c.tar.bz2 otp-c054ac3d4df7fe8b2f58204e677f275bd8f0e60c.zip |
wx: Fix cleanup of event handlers
Event handlers was not removed after objects/process had been
delete/died, which causes memory leakage and that fun's was
kept in the wx_server process. Code that might be purged and
the server died.
Diffstat (limited to 'lib/wx/test/wx_test_lib.erl')
-rw-r--r-- | lib/wx/test/wx_test_lib.erl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/wx/test/wx_test_lib.erl b/lib/wx/test/wx_test_lib.erl index 8509d6be6f..9b65a50864 100644 --- a/lib/wx/test/wx_test_lib.erl +++ b/lib/wx/test/wx_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -129,28 +129,30 @@ pick_msg() -> user_available(Config) -> false /= proplists:get_value(user, Config, false). - wx_destroy(Frame, Config) -> + wx_close(Frame, Config), + ?m(ok, wx:destroy()). + +wx_close(Frame, Config) -> case proplists:get_value(user, Config, false) of false -> timer:sleep(100), - ?m(ok, wxFrame:destroy(Frame)), - ?m(ok, wx:destroy()); + ?m(ok, wxWindow:destroy(Frame)); true -> timer:sleep(500), - ?m(ok, wxFrame:destroy(Frame)), - ?m(ok, wx:destroy()); + ?m(ok, wxWindow:destroy(Frame)); step -> %% Wait for user to close window ?m(ok, wxEvtHandler:connect(Frame, close_window, [{skip,true}])), - wait_for_close() + wait_for_close(), + catch wxEvtHandler:disconnect(Frame, close_window), + ok end. wait_for_close() -> receive #wx{event=#wxClose{}} -> - ?log("Got close~n",[]), - ?m(ok, wx:destroy()); + ?log("Got close~n",[]); #wx{obj=Obj, event=Event} -> try Name = wxTopLevelWindow:getTitle(Obj), |