File tree Expand file tree Collapse file tree 1 file changed +21
-10
lines changed
lib/wallets/wallet/intermediate Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,10 @@ abstract class LibXelisWallet<T extends ElectrumCurrency>
327327
328328 @override
329329 Future <void > open () async {
330+ while (exitInProgress) {
331+ await Future <void >.delayed (const Duration (milliseconds: 500 ));
332+ }
333+
330334 try {
331335 await connect ();
332336 } catch (e) {
@@ -339,18 +343,25 @@ abstract class LibXelisWallet<T extends ElectrumCurrency>
339343 unawaited (refresh ());
340344 }
341345
346+ bool exitInProgress = false ;
347+
342348 @override
343349 Future <void > exit () async {
344- await refreshMutex.protect (() async {
345- timer? .cancel ();
346- timer = null ;
347-
348- await _eventSubscription? .cancel ();
349- _eventSubscription = null ;
350-
351- await libXelisWallet? .offlineMode ();
352- await super .exit ();
353- });
350+ exitInProgress = true ;
351+ try {
352+ await refreshMutex.protect (() async {
353+ timer? .cancel ();
354+ timer = null ;
355+
356+ await _eventSubscription? .cancel ();
357+ _eventSubscription = null ;
358+
359+ await libXelisWallet? .offlineMode ();
360+ await super .exit ();
361+ });
362+ } finally {
363+ exitInProgress = false ;
364+ }
354365 }
355366
356367 void invalidSeedLengthCheck (int length) {
You can’t perform that action at this time.
0 commit comments