aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac.m
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-03 14:45:51 -0400
committerDavid Robillard <d@drobilla.net>2021-05-03 18:30:39 -0400
commit1b5cc87acd7cd6e12baab2f5b550b0d69f1361d5 (patch)
treeca89ab10280f5ba9808bddd6766eba3e725fdf5a /src/mac.m
parent66e589325d13e4efc195a80125805df4b0996a97 (diff)
downloadpugl-1b5cc87acd7cd6e12baab2f5b550b0d69f1361d5.tar.gz
pugl-1b5cc87acd7cd6e12baab2f5b550b0d69f1361d5.tar.bz2
pugl-1b5cc87acd7cd6e12baab2f5b550b0d69f1361d5.zip
Fix crash when freeing a view that has not been configured
Diffstat (limited to 'src/mac.m')
-rw-r--r--src/mac.m14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mac.m b/src/mac.m
index 9a650c3..e3af330 100644
--- a/src/mac.m
+++ b/src/mac.m
@@ -1084,15 +1084,23 @@ puglFreeViewInternals(PuglView* view)
}
if (view->impl) {
- [view->impl->wrapperView removeFromSuperview];
- view->impl->wrapperView->puglview = NULL;
+ if (view->impl->wrapperView) {
+ [view->impl->wrapperView removeFromSuperview];
+ view->impl->wrapperView->puglview = NULL;
+ }
+
if (view->impl->window) {
[view->impl->window close];
}
- [view->impl->wrapperView release];
+
+ if (view->impl->wrapperView) {
+ [view->impl->wrapperView release];
+ }
+
if (view->impl->window) {
[view->impl->window release];
}
+
free(view->impl);
}
}