summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2012-05-14 16:28:43 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2012-05-14 16:28:43 +0200
commit4a2bd440dd71faf6852d3653de02fc512ce8244f (patch)
treefb750113b361e25272020ee22cc48332aa418c03
parent5fe14d5bf11a22025914a1948770e0b720a8d46f (diff)
downloadmpv-4a2bd440dd71faf6852d3653de02fc512ce8244f.tar.bz2
mpv-4a2bd440dd71faf6852d3653de02fc512ce8244f.tar.xz
cocoa: handle failure on pixel format creation
This didn't make any difference on with OpenGL 2.1, but with the introduction of OpenGL3.2 it's possible for the pixel format creation to fail (if OpenGL3.2 is not supported). This code handles the failure case accordingly.
-rw-r--r--libvo/cocoa_common.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m
index 66f4cd3937..04b325405b 100644
--- a/libvo/cocoa_common.m
+++ b/libvo/cocoa_common.m
@@ -257,6 +257,12 @@ int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
attr[i] = (NSOpenGLPixelFormatAttribute)0;
s->pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease];
+ if (!s->pixelFormat) {
+ mp_msg(MSGT_VO, MSGL_ERR,
+ "[cocoa] Invalid pixel format attribute "
+ "(GL3 not supported?)\n");
+ return -1;
+ }
s->glContext = [[NSOpenGLContext alloc] initWithFormat:s->pixelFormat shareContext:nil];
create_menu();