diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/window/window.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/window/window.c b/src/window/window.c index abeca8e..0654e85 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -452,13 +452,9 @@ int mgl_window_init_from_existing_window(mgl_window *self, mgl_window_handle exi } void mgl_window_deinit(mgl_window *self) { - mgl_context *context = mgl_get_context(); x11_context *x11_context = self->context; - if(self->window) { - XDestroyWindow(context->connection, self->window); - self->window = 0; - } + mgl_window_close(self); if(x11_context) { x11_context_deinit(x11_context); @@ -953,9 +949,11 @@ bool mgl_window_is_mouse_button_pressed(const mgl_window *self, mgl_mouse_button void mgl_window_close(mgl_window *self) { mgl_context *context = mgl_get_context(); - XDestroyWindow(context->connection, self->window); - XSync(context->connection, False); - self->window = None; + if(self->window) { + XDestroyWindow(context->connection, self->window); + XSync(context->connection, False); + self->window = None; + } self->open = false; } |