aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}