aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-06-30 12:39:09 +0200
committerdec05eba <dec05eba@protonmail.com>2023-06-30 12:39:09 +0200
commitcc142e3e8223b6854ea08ba944c0a24905eedf88 (patch)
treec3c5e4b66079b975b79ce793ca380da8282bf963 /src
parent8d0c09bafe37653ed340acd89a27be6a4f928f9c (diff)
Cleanup window deinit
Diffstat (limited to 'src')
-rw-r--r--src/window/window.c14
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;
}