Skip to content

Commit

Permalink
clean return if x11/glx is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
x42 committed Jul 9, 2015
1 parent 70f57ce commit d8edb0c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pugl/pugl_x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ puglCreate(PuglNativeWindow parent,

impl->ctx = glXCreateContext(impl->display, vi, 0, GL_TRUE);

if (!impl->ctx) {
free(view);
free(impl);
return 0;
}

Window xParent = parent
? (Window)parent
: RootWindow(impl->display, impl->screen);
Expand All @@ -185,6 +191,12 @@ puglCreate(PuglNativeWindow parent,
0, 0, view->width, view->height, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &attr);

if (!impl->win) {
free(view);
free(impl);
return 0;
}

XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints));
if (view->set_window_hints) {
Expand Down

0 comments on commit d8edb0c

Please sign in to comment.