properly deregister render observers

This commit is contained in:
Justin R. Miller
2014-02-19 14:51:46 -08:00
parent 0f2beb6992
commit 9fbe5b2ece
2 changed files with 6 additions and 1 deletions

View File

@@ -141,6 +141,8 @@ class MBXMapView
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
mapView->settings.sync();
}

View File

@@ -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;