aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/observer_tv_wx.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-08-30 14:17:39 +0200
committerDan Gudmundsson <[email protected]>2016-09-01 10:30:39 +0200
commit80ba480787e1fce17d834a580ef427fcf07cc1e8 (patch)
tree2e0c6eec6f00372c2266c657e81d5dcdfa0df77c /lib/observer/src/observer_tv_wx.erl
parentb815d568e2e43d96698dbb8de6b993d55c1b14a0 (diff)
downloadotp-80ba480787e1fce17d834a580ef427fcf07cc1e8.tar.gz
otp-80ba480787e1fce17d834a580ef427fcf07cc1e8.tar.bz2
otp-80ba480787e1fce17d834a580ef427fcf07cc1e8.zip
observer: Fix error msg loop in table viewer
When observing mnesia table on remote node and connection to that node is lost, a loop of error messages occur if mnesia is not running on the observer node. ERL-237
Diffstat (limited to 'lib/observer/src/observer_tv_wx.erl')
-rw-r--r--lib/observer/src/observer_tv_wx.erl22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/observer/src/observer_tv_wx.erl b/lib/observer/src/observer_tv_wx.erl
index 59f6443551..968a7620aa 100644
--- a/lib/observer/src/observer_tv_wx.erl
+++ b/lib/observer/src/observer_tv_wx.erl
@@ -124,6 +124,8 @@ handle_event(#wx{id=Id}, State = #state{node=Node, grid=Grid, opt=Opt0})
end,
case get_tables2(Node, Opt) of
Error = {error, _} ->
+ Id =:= ?ID_MNESIA andalso
+ wxMenuBar:check(observer_wx:get_menubar(), ?ID_ETS, true),
self() ! Error,
{noreply, State};
Tables ->
@@ -217,22 +219,32 @@ handle_info(refresh_interval, State = #state{node=Node, grid=Grid, opt=Opt,
{noreply, State#state{tabs=Tabs}}
end;
-handle_info({active, Node}, State = #state{parent=Parent, grid=Grid, opt=Opt,
+handle_info({active, Node}, State = #state{parent=Parent, grid=Grid, opt=Opt0,
timer=Timer0}) ->
- Tables = get_tables(Node, Opt),
+ {Tables, Opt} = case Opt0#opt.type =:= mnesia andalso get_tables2(Node, Opt0) of
+ Ts when is_list(Ts) ->
+ {Ts, Opt0};
+ _ -> % false or error getting mnesia tables
+ Opt1 = Opt0#opt{type=ets},
+ {get_tables(Node, Opt1), Opt1}
+ end,
Tabs = update_grid(Grid, Opt, Tables),
wxWindow:setFocus(Grid),
create_menus(Parent, Opt),
Timer = observer_lib:start_timer(Timer0),
- {noreply, State#state{node=Node, tabs=Tabs, timer=Timer}};
+ {noreply, State#state{node=Node, tabs=Tabs, timer=Timer, opt=Opt}};
handle_info(not_active, State = #state{timer = Timer0}) ->
Timer = observer_lib:stop_timer(Timer0),
{noreply, State#state{timer=Timer}};
-handle_info({error, Error}, State) ->
+handle_info({error, Error}, #state{opt=Opt}=State) ->
handle_error(Error),
- {noreply, State};
+ case Opt#opt.type of
+ mnesia -> wxMenuBar:check(observer_wx:get_menubar(), ?ID_ETS, true);
+ _ -> ok
+ end,
+ {noreply, State#state{opt=Opt#opt{type=ets}}};
handle_info(_Event, State) ->
{noreply, State}.