diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-03-21 10:49:11 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-03-21 10:49:15 +0100 |
commit | c2af57a978b29e536260b6bf8440827a4d8e01f7 (patch) | |
tree | 6012d2f8d50aeb5d7b72bcf83ca406012f71bb13 /src/egl.c | |
parent | 61a25c0dcc7a1c64167aa316d0e7514fbd778fea (diff) |
Destroy glx context on fail/deinit
Diffstat (limited to 'src/egl.c')
-rw-r--r-- | src/egl.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -318,6 +318,12 @@ static bool gsr_egl_switch_to_glx_context(gsr_egl *self) { return true; fail: + if(self->glx_context) { + self->glXMakeContextCurrent(self->x11.dpy, None, None, NULL); + self->glXDestroyContext(self->x11.dpy, self->glx_context); + self->glx_context = NULL; + self->glx_fb_config = NULL; + } return false; } @@ -372,6 +378,7 @@ static bool gsr_egl_load_glx(gsr_egl *self, void *library) { { (void**)&self->glXChooseFBConfig, "glXChooseFBConfig" }, { (void**)&self->glXMakeContextCurrent, "glXMakeContextCurrent" }, { (void**)&self->glXCreateNewContext, "glXCreateNewContext" }, + { (void**)&self->glXDestroyContext, "glXDestroyContext" }, { (void**)&self->glXSwapBuffers, "glXSwapBuffers" }, { NULL, NULL } @@ -567,6 +574,13 @@ void gsr_egl_unload(gsr_egl *self) { self->egl_display = NULL; } + if(self->glx_context) { + self->glXMakeContextCurrent(self->x11.dpy, None, None, NULL); + self->glXDestroyContext(self->x11.dpy, self->glx_context); + self->glx_context = NULL; + self->glx_fb_config = NULL; + } + if(self->x11.window) { XDestroyWindow(self->x11.dpy, self->x11.window); self->x11.window = None; |