Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
method channels to strong
  • Loading branch information
Chris Yang committed May 27, 2022
commit 459555d5a8d832d946c374a9c69777979a4ae3ed
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ - (void)interpretTileOverlayOptions:(NSDictionary *)data {

@interface FLTTileProviderController ()

@property(weak, nonatomic) FlutterMethodChannel *methodChannel;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same reason I made all method channels to be weak in this PR. The owner of the methodchannel is FLTGoogleMapController. And FLTGoogleMapController owns and out lives all the sub controllers, so I thought it is not necessary for the sub controllers to strongly own methodChannel.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then did you mean to make it strong in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, to match other controllers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should they all be weak as you had it before? I'm not trying to argue one way or the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Strong is better. There won't be a retain cycle as method channel is not going to have a strong reference to the controllers.
Having them as weak makes the methodChannel's life cycle confusing. One needs to figure out who strongly owns the methodChannel (GoogleMapsController) to understand its life cycle.

@property(strong, nonatomic) FlutterMethodChannel *methodChannel;

@end

Expand Down Expand Up @@ -160,7 +160,7 @@ - (void)requestTileForX:(NSUInteger)x
@interface FLTTileOverlaysController ()

@property(strong, nonatomic) NSMutableDictionary *tileOverlayIdentifierToController;
@property(weak, nonatomic) FlutterMethodChannel *methodChannel;
@property(strong, nonatomic) FlutterMethodChannel *methodChannel;
@property(weak, nonatomic) GMSMapView *mapView;

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ - (void)interpretCircleOptions:(NSDictionary *)data {

@interface FLTCirclesController ()

@property(weak, nonatomic) FlutterMethodChannel *methodChannel;
@property(strong, nonatomic) FlutterMethodChannel *methodChannel;
@property(weak, nonatomic) GMSMapView *mapView;
@property(strong, nonatomic) NSMutableDictionary *circleIdToController;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ - (UIImage *)scaleImage:(UIImage *)image by:(id)scaleParam {
@interface FLTMarkersController ()

@property(strong, nonatomic) NSMutableDictionary *markerIdentifierToController;
@property(weak, nonatomic) FlutterMethodChannel *methodChannel;
@property(strong, nonatomic) FlutterMethodChannel *methodChannel;
@property(weak, nonatomic) NSObject<FlutterPluginRegistrar> *registrar;
@property(weak, nonatomic) GMSMapView *mapView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ - (void)interpretPolygonOptions:(NSDictionary *)data
@interface FLTPolygonsController ()

@property(strong, nonatomic) NSMutableDictionary *polygonIdentifierToController;
@property(weak, nonatomic) FlutterMethodChannel *methodChannel;
@property(strong, nonatomic) FlutterMethodChannel *methodChannel;
@property(weak, nonatomic) NSObject<FlutterPluginRegistrar> *registrar;
@property(weak, nonatomic) GMSMapView *mapView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ - (void)interpretPolylineOptions:(NSDictionary *)data
@interface FLTPolylinesController ()

@property(strong, nonatomic) NSMutableDictionary *polylineIdentifierToController;
@property(weak, nonatomic) FlutterMethodChannel *methodChannel;
@property(strong, nonatomic) FlutterMethodChannel *methodChannel;
@property(weak, nonatomic) NSObject<FlutterPluginRegistrar> *registrar;
@property(weak, nonatomic) GMSMapView *mapView;

Expand Down