From 2bf7f501722473cadc856a54712664245775fbd1 Mon Sep 17 00:00:00 2001 From: thirteenthstep Date: Fri, 31 Jul 2020 09:38:25 +0200 Subject: [PATCH] fix memory leak caused by strong self reference --- ios/Classes/MapboxMapController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Classes/MapboxMapController.swift b/ios/Classes/MapboxMapController.swift index 6384ee51a..9f986025d 100644 --- a/ios/Classes/MapboxMapController.swift +++ b/ios/Classes/MapboxMapController.swift @@ -38,7 +38,7 @@ class MapboxMapController: NSObject, FlutterPlatformView, MGLMapViewDelegate, Ma super.init() channel = FlutterMethodChannel(name: "plugins.flutter.io/mapbox_maps_\(viewId)", binaryMessenger: registrar.messenger()) - channel!.setMethodCallHandler(onMethodCall) + channel!.setMethodCallHandler{ [weak self] in self?.onMethodCall(methodCall: $0, result: $1) } mapView.delegate = self