diff options
author | Jordan Halase <jordan@halase.me> | 2019-10-22 14:54:47 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-11-03 20:52:32 +0100 |
commit | a96511e36737284589361616f4fb4c0874095da7 (patch) | |
tree | 673fef8758a901db01ff68eb24108f918dbda4b6 /pugl/detail/x11.c | |
parent | 3d6b80ccb48068b001efd6ff369386e69c21c580 (diff) | |
download | pugl-a96511e36737284589361616f4fb4c0874095da7.tar.gz pugl-a96511e36737284589361616f4fb4c0874095da7.tar.bz2 pugl-a96511e36737284589361616f4fb4c0874095da7.zip |
Fix puglFreeView() crashes when window creation failed
Diffstat (limited to 'pugl/detail/x11.c')
-rw-r--r-- | pugl/detail/x11.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 429d89f..7bf5223 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -266,12 +266,16 @@ puglHideWindow(PuglView* view) void puglFreeViewInternals(PuglView* view) { - if (view) { + if (view && view->impl) { if (view->impl->xic) { XDestroyIC(view->impl->xic); } - view->backend->destroy(view); - XDestroyWindow(view->impl->display, view->impl->win); + if (view->backend) { + view->backend->destroy(view); + } + if (view->impl->display) { + XDestroyWindow(view->impl->display, view->impl->win); + } XFree(view->impl->vi); free(view->impl); } |