Skip to content

Commit 9ab15d2

Browse files
Merge pull request #1169 from cypherstack/macos-mwebd
fix(macos): close mwebd on app close
2 parents 6e4af03 + 99f66cc commit 9ab15d2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lib/main.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import 'dart:async';
1212
import 'dart:io';
1313
import 'dart:math';
14+
import 'dart:ui';
1415

1516
import 'package:coinlib_flutter/coinlib_flutter.dart';
1617
import 'package:compat/compat.dart' as lib_monero_compat;
@@ -621,6 +622,21 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
621622
}
622623
}
623624

625+
@override
626+
Future<AppExitResponse> didRequestAppExit() async {
627+
debugPrint("didRequestAppExit called");
628+
if (Platform.isMacOS) {
629+
// On macOS, mwebd fails to shut down, hanging the app on close.
630+
//
631+
// Exiting is a hack fix for this issue.
632+
633+
// await ref.read(pMwebService).shutdown();
634+
// Something like the above would probably be prudent to make.
635+
exit(0);
636+
}
637+
return AppExitResponse.exit;
638+
}
639+
624640
/// should only be called on android currently
625641
Future<void> getOpenFile() async {
626642
// update provider with new file content state

0 commit comments

Comments
 (0)