diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-11-23 12:03:34 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-11-28 15:45:43 -0800 |
commit | 03a2dbe3615cd525d091e49f640f960fa2b28a81 (patch) | |
tree | d155ba67d9af65371897c62cab0170352bc45c1f /platform/macos/app | |
parent | 9fac640bf35db408f56103b45f8ef7982204bfa9 (diff) | |
download | qtlocation-mapboxgl-03a2dbe3615cd525d091e49f640f960fa2b28a81.tar.gz |
[macos] Avoid first responder action name conflict
Fixed a crash that often occurred when switching styles. MGLMapView was ahead of MapDocument in the responder chain, so calls to -setStyle: were going to MGLMapView’s private -setStyle: method. The sender was being passed in the first parameter instead of an MGLStyle method.
Diffstat (limited to 'platform/macos/app')
-rw-r--r-- | platform/macos/app/Base.lproj/MainMenu.xib | 12 | ||||
-rw-r--r-- | platform/macos/app/Base.lproj/MapDocument.xib | 2 | ||||
-rw-r--r-- | platform/macos/app/MapDocument.h | 2 | ||||
-rw-r--r-- | platform/macos/app/MapDocument.m | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib index 716872a32a..7dd4d08430 100644 --- a/platform/macos/app/Base.lproj/MainMenu.xib +++ b/platform/macos/app/Base.lproj/MainMenu.xib @@ -366,32 +366,32 @@ <items> <menuItem title="Streets" state="on" tag="1" keyEquivalent="1" id="17N-yz-NNo"> <connections> - <action selector="setStyle:" target="-1" id="I4L-Wx-UXA"/> + <action selector="showStyle:" target="-1" id="BGu-va-ftr"/> </connections> </menuItem> <menuItem title="Outdoors" tag="2" keyEquivalent="2" id="BBa-Qa-SQr"> <connections> - <action selector="setStyle:" target="-1" id="rM1-yG-t5u"/> + <action selector="showStyle:" target="-1" id="sQ3-b6-G1A"/> </connections> </menuItem> <menuItem title="Light" tag="3" keyEquivalent="3" id="HWe-7u-UVJ"> <connections> - <action selector="setStyle:" target="-1" id="Q9V-O1-oRz"/> + <action selector="showStyle:" target="-1" id="jMN-oR-sbZ"/> </connections> </menuItem> <menuItem title="Dark" tag="4" keyEquivalent="4" id="6HI-q6-AeV"> <connections> - <action selector="setStyle:" target="-1" id="YfH-1I-G50"/> + <action selector="showStyle:" target="-1" id="xgf-Sq-eJw"/> </connections> </menuItem> <menuItem title="Satellite" tag="5" keyEquivalent="5" id="h0J-5X-kgF"> <connections> - <action selector="setStyle:" target="-1" id="GXt-oK-Hy1"/> + <action selector="showStyle:" target="-1" id="YyE-2C-Vhj"/> </connections> </menuItem> <menuItem title="Satellite Streets" tag="6" keyEquivalent="6" id="9BL-00-HFt"> <connections> - <action selector="setStyle:" target="-1" id="oL4-AC-waq"/> + <action selector="showStyle:" target="-1" id="NTT-Y1-EqU"/> </connections> </menuItem> <menuItem title="Custom Style…" id="L0h-86-2cU"> diff --git a/platform/macos/app/Base.lproj/MapDocument.xib b/platform/macos/app/Base.lproj/MapDocument.xib index 2fb02f9c47..4e58490e68 100644 --- a/platform/macos/app/Base.lproj/MapDocument.xib +++ b/platform/macos/app/Base.lproj/MapDocument.xib @@ -86,7 +86,7 @@ </popUpButtonCell> </popUpButton> <connections> - <action selector="setStyle:" target="-1" id="2Kw-9i-a3G"/> + <action selector="showStyle:" target="-1" id="pBn-SO-HIX"/> </connections> </toolbarItem> </allowedToolbarItems> diff --git a/platform/macos/app/MapDocument.h b/platform/macos/app/MapDocument.h index 86ad05e6e2..fa70212cf8 100644 --- a/platform/macos/app/MapDocument.h +++ b/platform/macos/app/MapDocument.h @@ -6,7 +6,7 @@ @property (weak) IBOutlet MGLMapView *mapView; -- (IBAction)setStyle:(id)sender; +- (IBAction)showStyle:(id)sender; - (IBAction)chooseCustomStyle:(id)sender; - (IBAction)reload:(id)sender; diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index e4fe202f3f..f9477206aa 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -143,7 +143,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio #pragma mark View methods -- (IBAction)setStyle:(id)sender { +- (IBAction)showStyle:(id)sender { NSInteger tag; if ([sender isKindOfClass:[NSMenuItem class]]) { tag = [sender tag]; @@ -563,7 +563,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio #pragma mark User interface validation - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - if (menuItem.action == @selector(setStyle:)) { + if (menuItem.action == @selector(showStyle:)) { NSURL *styleURL = self.mapView.styleURL; NSCellStateValue state; switch (menuItem.tag) { @@ -731,7 +731,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio return ([styleURL.scheme isEqualToString:@"mapbox"] && [styleURL.pathComponents.firstObject isEqualToString:@"styles"]); } - if (toolbarItem.action == @selector(setStyle:)) { + if (toolbarItem.action == @selector(showStyle:)) { NSPopUpButton *popUpButton = (NSPopUpButton *)toolbarItem.view; NSUInteger index = self.indexOfStyleInToolbarItem; if (index == NSNotFound) { |