summaryrefslogtreecommitdiff
path: root/pugl/pugl_osx.m
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-11 22:34:48 +0000
committerDavid Robillard <d@drobilla.net>2012-05-11 22:34:48 +0000
commit53f8f81e2742876c8192b9429c4d4d20e9722b8b (patch)
tree667720fb6c5f8b1dba3a64b38eb1f030687b43a8 /pugl/pugl_osx.m
parentc5cf34948acafc7ecb22e481fd513c62111bbc0f (diff)
Fix memory leaks.
Diffstat (limited to 'pugl/pugl_osx.m')
-rw-r--r--pugl/pugl_osx.m14
1 files changed, 8 insertions, 6 deletions
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m
index 2f4a0e9..b3b6bae 100644
--- a/pugl/pugl_osx.m
+++ b/pugl/pugl_osx.m
@@ -216,7 +216,7 @@ getModifiers(unsigned modifierFlags)
@end
-struct PuglPlatformDataImpl {
+struct PuglInternalsImpl {
PuglOpenGLView* view;
NSModalSession session;
id window;
@@ -229,14 +229,16 @@ puglCreate(PuglNativeWindow parent,
int height,
bool resizable)
{
- PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
+ PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
+ PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals));
+ if (!view || !impl) {
+ return NULL;
+ }
+
+ view->impl = impl;
view->width = width;
view->height = height;
- view->impl = (PuglPlatformData*)calloc(1, sizeof(PuglPlatformData));
-
- PuglPlatformData* impl = view->impl;
-
[NSAutoreleasePool new];
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];