diff --git a/src/gd_con.erl b/src/gd_con.erl index 7bc853f..88b9e71 100644 --- a/src/gd_con.erl +++ b/src/gd_con.erl @@ -357,9 +357,7 @@ init(none) -> Window = gd_gui:start_link(GUI_Prefs), Wallets = get_prefs(wallets, Prefs, []), ok = hz:timeout(default_tic()), - MS = default_tic(), - T = erlang:send_after(MS, self(), tic), - State = #s{window = Window, timer = {T, MS}, wallets = Wallets, prefs = Prefs}, + State = #s{window = Window, wallets = Wallets, prefs = Prefs}, NewState = do_show_ui(gd_v_wallman, State), ok = case FirstRun of @@ -1076,7 +1074,7 @@ do_drop_key(ID, State = #s{wallet = W, wallets = Wallets, pass = Pass}) -> State#s{wallet = NewWallet}. -do_open_wallet(Path, Phrase, State) -> +do_open_wallet(Path, Phrase, State = #s{timer = Timer}) -> Pass = pass(Phrase), case read(Path, Pass) of {ok, Recovered = #wallet{name = Name, poas = POAs, endpoint = _Node}} -> @@ -1088,7 +1086,17 @@ do_open_wallet(Path, Phrase, State) -> % {ok, ChainID} -> gd_gui:chain(ChainID, Node); % Error -> gd_gui:trouble(Error) % end, - {ok, State#s{pass = Pass, wallet = Recovered}}; + ok = + case Timer of + none -> + ok; + {OldT, _} -> + _ = erlang:cancel_timer(OldT), + ok + end, + MS = default_tic(), + T = erlang:send_after(200, self(), tic), + {ok, State#s{pass = Pass, wallet = Recovered, timer = {T, MS}}}; Error -> {Error, State} end.