From 91e67488391eee5f330da55339d46673848b9777 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 19 Jun 2012 10:34:55 +0200 Subject: Fix process_info from app tab on other nodes --- lib/observer/src/observer_app_wx.erl | 10 ++++++++-- lib/observer/src/observer_tv_table.erl | 3 ++- lib/observer/src/observer_wx.erl | 15 ++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) (limited to 'lib/observer/src') diff --git a/lib/observer/src/observer_app_wx.erl b/lib/observer/src/observer_app_wx.erl index f9be11e05a..380532e90c 100644 --- a/lib/observer/src/observer_app_wx.erl +++ b/lib/observer/src/observer_app_wx.erl @@ -267,9 +267,15 @@ handle_call(Event, From, _State) -> handle_cast(Event, _State) -> error({unhandled_cast, Event}). %%%%%%%%%% -handle_info({active, Node}, State = #state{parent=Parent, current=Curr}) -> +handle_info({active, Node}, State = #state{parent=Parent, current=Curr, appmon=Appmon}) -> create_menus(Parent, []), - {ok, Pid} = appmon_info:start_link(Node, self(), []), + Pid = try + Node = node(Appmon), + Appmon + catch _:_ -> + {ok, P} = appmon_info:start_link(Node, self(), []), + P + end, appmon_info:app_ctrl(Pid, Node, true, []), (Curr =/= undefined) andalso appmon_info:app(Pid, Curr, true, []), {noreply, State#state{appmon=Pid}}; diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl index 3930f9ee26..f18d346f83 100644 --- a/lib/observer/src/observer_tv_table.erl +++ b/lib/observer/src/observer_tv_table.erl @@ -265,7 +265,8 @@ handle_event(#wx{id=?ID_DELETE}, wxStatusBar:setStatusText(StatusBar, io_lib:format("Deleted object: ~s",[Str])), {noreply, State}; -handle_event(#wx{id=?wxID_CLOSE}, State) -> +handle_event(#wx{id=?wxID_CLOSE}, State = #state{frame=Frame}) -> + wxFrame:destroy(Frame), {stop, normal, State}; handle_event(Help = #wx{id=?wxID_HELP}, State) -> diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl index ce3f48a05d..80f4fe1796 100644 --- a/lib/observer/src/observer_wx.erl +++ b/lib/observer/src/observer_wx.erl @@ -195,10 +195,13 @@ setup(#state{frame = Frame} = State) -> %%Callbacks handle_event(#wx{event=#wxNotebook{type=command_notebook_page_changing}}, #state{active_tab=Previous, node=Node} = State) -> - Pid = get_active_pid(State), - Previous ! not_active, - Pid ! {active, Node}, - {noreply, State#state{active_tab=Pid}}; + case get_active_pid(State) of + Previous -> {noreply, State}; + Pid -> + Previous ! not_active, + Pid ! {active, Node}, + {noreply, State#state{active_tab=Pid}} + end; handle_event(#wx{event = #wxClose{}}, State) -> {stop, normal, State}; @@ -410,7 +413,9 @@ connect2(NodeName, Opts, Cookie) -> end. change_node_view(Node, State) -> - get_active_pid(State) ! {active, Node}, + Tab = get_active_pid(State), + Tab ! not_active, + Tab ! {active, Node}, StatusText = ["Observer - " | atom_to_list(Node)], wxFrame:setTitle(State#state.frame, StatusText), wxStatusBar:setStatusText(State#state.status_bar, StatusText), -- cgit v1.2.3