[macOS] Fixes Crash of cxx destruction when App will terminate (flutter/engine#29502)
This commit is contained in:
@@ -254,6 +254,10 @@ static void CommonInit(FlutterViewController* controller) {
|
||||
selector:@selector(onAccessibilityStatusChanged:)
|
||||
name:EnhancedUserInterfaceNotification
|
||||
object:nil];
|
||||
[center addObserver:controller
|
||||
selector:@selector(applicationWillTerminate:)
|
||||
name:NSApplicationWillTerminateNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder*)coder {
|
||||
@@ -557,6 +561,13 @@ static void CommonInit(FlutterViewController* controller) {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification*)notification {
|
||||
if (!_engine) {
|
||||
return;
|
||||
}
|
||||
[_engine shutDownEngine];
|
||||
}
|
||||
|
||||
- (void)onAccessibilityStatusChanged:(NSNotification*)notification {
|
||||
if (!_engine) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user