diff options
-rw-r--r-- | ios/MBXViewController.mm | 2 | ||||
-rw-r--r-- | macosx/main.mm | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm index bea95d2bbd..8d734459cd 100644 --- a/ios/MBXViewController.mm +++ b/ios/MBXViewController.mm @@ -141,6 +141,8 @@ class MBXMapView - (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + mapView->settings.sync(); } diff --git a/macosx/main.mm b/macosx/main.mm index c4f3c87a57..7c2f0cc1ec 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -56,7 +56,7 @@ public: glfwSetCharCallback(window, character); glfwSetKeyCallback(window, key); - [[NSNotificationCenter defaultCenter] addObserverForName:MBXNeedsRenderNotification + renderObserver = [[NSNotificationCenter defaultCenter] addObserverForName:MBXNeedsRenderNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock: ^ (NSNotification * notification) { @@ -198,6 +198,7 @@ public: } ~MapView() { + [[NSNotificationCenter defaultCenter] removeObserver:renderObserver]; glfwTerminate(); } @@ -214,6 +215,8 @@ public: GLFWwindow *window; llmr::Settings_MacOSX settings; llmr::Map map; + + id renderObserver; }; MapView *mapView; |