Skip to content

Commit 9c935f6

Browse files
committed
ios: cleanup when detaching from engine. #181
1 parent 9d02426 commit 9c935f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

darwin/Classes/FvpPlugin.mm

+5
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
133133
#endif
134134
FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"fvp" binaryMessenger:messenger];
135135
FvpPlugin* instance = [[FvpPlugin alloc] initWithRegistrar:registrar];
136+
[registrar publish:instance];
136137
[registrar addMethodCallDelegate:instance channel:channel];
137138
SetGlobalOption("MDK_KEY", "C03BFF5306AB39058A767105F82697F42A00FE970FB0E641D306DEFF3F220547E5E5377A3C504DC30D547890E71059BC023A4DD91A95474D1F33CA4C26C81B0FC73B00ACF954C6FA75898EFA07D9680B6A00FDF179C0A15381101D01124498AF55B069BD4B0156D5CF5A56DEDE782E5F3930AD47C8F40BFBA379231142E31B0F");
138139
}
@@ -176,4 +177,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
176177
}
177178
}
178179

180+
// ios only, optional. called first in dealloc(texture registry is still alive). plugin instance must be registered via publish
181+
- (void)detachFromEngineForRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
182+
players.clear();
183+
}
179184
@end

0 commit comments

Comments
 (0)