aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-10 23:10:46 +0000
committerDavid Robillard <d@drobilla.net>2012-05-10 23:10:46 +0000
commitc5cf34948acafc7ecb22e481fd513c62111bbc0f (patch)
treeefe34dbc7cd40293570ae4efd397f32417d94427
parentf027f3810baaa93bd4b8273b774421053e8e1cac (diff)
Destroy window before closing display.
-rw-r--r--pugl/pugl_x11.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index d80b71b..dde2b23 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -155,14 +155,13 @@ puglCreate(PuglNativeWindow parent,
void
puglDestroy(PuglView* view)
{
- if (view->impl->ctx) {
- if (!glXMakeCurrent(view->impl->display, None, NULL)) {
- printf("Could not release drawing context.\n");
- }
- glXDestroyContext(view->impl->display, view->impl->ctx);
- view->impl->ctx = NULL;
+ if (!view) {
+ return;
}
+ glXMakeCurrent(view->impl->display, None, NULL);
+ glXDestroyContext(view->impl->display, view->impl->ctx);
+ XDestroyWindow(view->impl->display, view->impl->win);
XCloseDisplay(view->impl->display);
free(view);
}