diff options
author | Jesse Bounds <jesse@rebounds.net> | 2016-11-14 15:50:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-14 15:50:33 -0800 |
commit | 1c9d314236736bf47e33fb95d2b457a5650fc519 (patch) | |
tree | 48b610e5bc18be13de161707488d1cb43b950c9d /platform/darwin/src/MGLStyleLayer_Private.h | |
parent | 56c2272b7dc261f988c70e0f8cb90ff853932011 (diff) | |
download | qtlocation-mapboxgl-1c9d314236736bf47e33fb95d2b457a5650fc519.tar.gz |
[ios, macos] Take back source and layer ownership on removal (#7048)
If a source or layer is removed from the style, recapture the
unique pointer ownership. This makes it safe to add back sources
and layers after they have been removed.
Diffstat (limited to 'platform/darwin/src/MGLStyleLayer_Private.h')
-rw-r--r-- | platform/darwin/src/MGLStyleLayer_Private.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLStyleLayer_Private.h b/platform/darwin/src/MGLStyleLayer_Private.h index f61630b8c4..bfce452a4a 100644 --- a/platform/darwin/src/MGLStyleLayer_Private.h +++ b/platform/darwin/src/MGLStyleLayer_Private.h @@ -29,11 +29,18 @@ */ - (void)addToMapView:(MGLMapView *)mapView; - +/** + Removes the mbgl style layer that this object represents from the mbgl map. + + When a mbgl style layer is removed, ownership of the object is transferred back + to the `MGLStyleLayer` instance and the unique_ptr reference is valid again. It + is safe to add the layer back to the style after it is removed. + */ +- (void)removeFromMapView:(MGLMapView *)mapView; /** Adds the mbgl style layer that this object represents to the mbgl map below the specified `otherLayer`. - + Once a mbgl style layer is added, ownership of the object is transferred to the `mbgl::Map` and this object no longer has an active unique_ptr reference to the `mbgl::style::Layer`. |