aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/src/reltool_sys_win.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-01-20 17:10:31 +0100
committerSiri Hansen <[email protected]>2012-03-19 09:48:53 +0100
commit610280492bca33c851eabda0a2daf5cf141ea090 (patch)
tree957671deb8bef7fc633eea5a16aafce06f5816e2 /lib/reltool/src/reltool_sys_win.erl
parent06ea8c9f62e265bc045eb92d522e84a5f208f8cd (diff)
downloadotp-610280492bca33c851eabda0a2daf5cf141ea090.tar.gz
otp-610280492bca33c851eabda0a2daf5cf141ea090.tar.bz2
otp-610280492bca33c851eabda0a2daf5cf141ea090.zip
[reltool] Add test case for reltool_server:get_mod
OTP-9794 This test case revealed a bug that occurs when calling reltool_server:get_mod after reltool_server:undo_config. get_mod reads from the module table (ets) and not from the reltool_server state, while undo_config only changes the state. This bug has been corrected, so undo_config now updates both state and tables (it does the same as set_sys).
Diffstat (limited to 'lib/reltool/src/reltool_sys_win.erl')
-rw-r--r--lib/reltool/src/reltool_sys_win.erl25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/reltool/src/reltool_sys_win.erl b/lib/reltool/src/reltool_sys_win.erl
index 8b0f64eb45..f29a95af38 100644
--- a/lib/reltool/src/reltool_sys_win.erl
+++ b/lib/reltool/src/reltool_sys_win.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2012. 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
@@ -1290,7 +1290,15 @@ reset_config(#state{status_bar = Bar} = S) ->
undo_config(#state{status_bar = Bar} = S) ->
wxStatusBar:setStatusText(Bar, "Processing libraries..."),
- ok = reltool_server:undo_config(S#state.server_pid),
+ case reltool_server:undo_config(S#state.server_pid) of
+ {ok, []} ->
+ ok;
+ {ok, Warnings} ->
+ Msg = lists:flatten([[W, $\n] || W <- Warnings]),
+ display_message(Msg, ?wxICON_WARNING);
+ {error, Reason} ->
+ display_message(Reason, ?wxICON_ERROR)
+ end,
refresh(S).
load_config(#state{status_bar = Bar, config_file = OldFile} = S) ->
@@ -1444,8 +1452,17 @@ undo_dialog(S, Warnings) ->
?wxID_OK ->
true;
?wxID_CANCEL ->
- reltool_server:undo_config(S#state.server_pid),
- false
+ case reltool_server:undo_config(S#state.server_pid) of
+ {ok, _} ->
+ false;
+ {error, Reason} ->
+ Msg = "FATAL - undo failed:\n\n" ++
+ Reason ++
+ "\n\nTerminating...",
+ display_message(Msg, ?wxICON_ERROR),
+ io:format("~p(~p): <ERROR> ~s\n", [?MODULE, ?LINE, Reason]),
+ exit(Reason)
+ end
end.
display_message(Message, Icon) ->