aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/mac.m
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/detail/mac.m')
-rw-r--r--pugl/detail/mac.m27
1 files changed, 17 insertions, 10 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index ab13452..c9847eb 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -818,17 +818,24 @@ puglHideWindow(PuglView* view)
void
puglFreeViewInternals(PuglView* view)
{
- view->backend->destroy(view);
- [view->impl->wrapperView removeFromSuperview];
- view->impl->wrapperView->puglview = NULL;
- if (view->impl->window) {
- [view->impl->window close];
- }
- [view->impl->wrapperView release];
- if (view->impl->window) {
- [view->impl->window release];
+ if (view) {
+ if (view->backend) {
+ view->backend->destroy(view);
+ }
+
+ if (view->impl) {
+ [view->impl->wrapperView removeFromSuperview];
+ view->impl->wrapperView->puglview = NULL;
+ if (view->impl->window) {
+ [view->impl->window close];
+ }
+ [view->impl->wrapperView release];
+ if (view->impl->window) {
+ [view->impl->window release];
+ }
+ free(view->impl);
+ }
}
- free(view->impl);
}
PuglStatus