From 9c935f658e248e30f9c9f85dbc314ea032246e1f Mon Sep 17 00:00:00 2001 From: wang-bin Date: Mon, 18 Nov 2024 01:13:13 +0800 Subject: [PATCH] ios: cleanup when detaching from engine. #181 --- darwin/Classes/FvpPlugin.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/darwin/Classes/FvpPlugin.mm b/darwin/Classes/FvpPlugin.mm index bba4776..21c9395 100644 --- a/darwin/Classes/FvpPlugin.mm +++ b/darwin/Classes/FvpPlugin.mm @@ -133,6 +133,7 @@ + (void)registerWithRegistrar:(NSObject*)registrar { #endif FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"fvp" binaryMessenger:messenger]; FvpPlugin* instance = [[FvpPlugin alloc] initWithRegistrar:registrar]; + [registrar publish:instance]; [registrar addMethodCallDelegate:instance channel:channel]; SetGlobalOption("MDK_KEY", "C03BFF5306AB39058A767105F82697F42A00FE970FB0E641D306DEFF3F220547E5E5377A3C504DC30D547890E71059BC023A4DD91A95474D1F33CA4C26C81B0FC73B00ACF954C6FA75898EFA07D9680B6A00FDF179C0A15381101D01124498AF55B069BD4B0156D5CF5A56DEDE782E5F3930AD47C8F40BFBA379231142E31B0F"); } @@ -176,4 +177,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { } } +// ios only, optional. called first in dealloc(texture registry is still alive). plugin instance must be registered via publish +- (void)detachFromEngineForRegistrar:(NSObject *)registrar { + players.clear(); +} @end