aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/observer_app_wx.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-04-16 12:48:06 +0200
committerDan Gudmundsson <[email protected]>2012-04-23 11:26:03 +0200
commitecb00fe42e43c5876ae100601b3caa9b1cc8d3bb (patch)
tree5c75689755a3db77f1b1ca835a9ac9b1b0925ade /lib/observer/src/observer_app_wx.erl
parent861454268770e05bd72312c1a46560ed29a42500 (diff)
downloadotp-ecb00fe42e43c5876ae100601b3caa9b1cc8d3bb.tar.gz
otp-ecb00fe42e43c5876ae100601b3caa9b1cc8d3bb.tar.bz2
otp-ecb00fe42e43c5876ae100601b3caa9b1cc8d3bb.zip
[observer] Remove appmon ref when node goes down
Diffstat (limited to 'lib/observer/src/observer_app_wx.erl')
-rw-r--r--lib/observer/src/observer_app_wx.erl16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/observer/src/observer_app_wx.erl b/lib/observer/src/observer_app_wx.erl
index 7eac2b8fab..a5ad2f6289 100644
--- a/lib/observer/src/observer_app_wx.erl
+++ b/lib/observer/src/observer_app_wx.erl
@@ -267,24 +267,16 @@ handle_call(Event, From, _State) ->
handle_cast(Event, _State) ->
error({unhandled_cast, Event}).
%%%%%%%%%%
-handle_info({active, Node}, State = #state{parent=Parent, current=Curr, appmon=Appmon}) ->
+handle_info({active, Node}, State = #state{parent=Parent, current=Curr}) ->
create_menus(Parent, []),
{ok, Pid} = appmon_info:start_link(Node, self(), []),
- case Appmon of
- undefined -> ok;
- Pid -> ok;
- _ -> %% Deregister me as client (and stop appmon if last)
- exit(Appmon, normal)
- end,
appmon_info:app_ctrl(Pid, Node, true, []),
(Curr =/= undefined) andalso appmon_info:app(Pid, Curr, true, []),
{noreply, State#state{appmon=Pid}};
-
-handle_info(not_active, State = #state{appmon=AppMon, current=Prev}) ->
+handle_info(not_active, State = #state{appmon=AppMon}) ->
appmon_info:app_ctrl(AppMon, node(AppMon), false, []),
- (Prev =/= undefined) andalso appmon_info:app(AppMon, Prev, false, []),
- {noreply, State};
-
+ lists:member(node(AppMon), nodes()) andalso exit(AppMon, normal),
+ {noreply, State#state{appmon=undefined}};
handle_info({delivery, Pid, app_ctrl, _, Apps0},
State = #state{appmon=Pid, apps_w=LBox, current=Curr0}) ->
Apps = [atom_to_list(App) || {_, App, {_, _, _}} <- Apps0],