diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-09-10 06:55:38 +0300 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2019-09-09 23:55:38 -0400 |
commit | 5207a360746d7d0541e21ca4e8d22b432f41d8f5 (patch) | |
tree | 6bb894331c13de8c1f253872639f17ae3c3c6aea /platform/darwin/src/MGLSource_Private.h | |
parent | 45140af7cb7f485008905a645e043480615109bc (diff) | |
download | qtlocation-mapboxgl-5207a360746d7d0541e21ca4e8d22b432f41d8f5.tar.gz |
[core, ios, macos] SDK objects should hold weak pointers to the core style objects (#15539)
Diffstat (limited to 'platform/darwin/src/MGLSource_Private.h')
-rw-r--r-- | platform/darwin/src/MGLSource_Private.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLSource_Private.h b/platform/darwin/src/MGLSource_Private.h index af14c11b90..4a7c31694d 100644 --- a/platform/darwin/src/MGLSource_Private.h +++ b/platform/darwin/src/MGLSource_Private.h @@ -2,6 +2,7 @@ #include <memory> + NS_ASSUME_NONNULL_BEGIN namespace mbgl { @@ -18,6 +19,20 @@ struct SourceWrapper { __weak MGLSource *source; }; +/** + Assert that the style source is valid. + + This macro should be used at the beginning of any public-facing instance method + of `MGLSource` and its subclasses. For private methods, an assertion is more appropriate. + */ +#define MGLAssertStyleSourceIsValid() \ +do { \ + if (!self.rawSource) { \ + [NSException raise:MGLInvalidStyleSourceException \ + format:@"This source got invalidated after the style change"]; \ + } \ +} while (NO); + @class MGLMapView; @interface MGLSource (Private) |