Skip to content

Commit

Permalink
backend: gl: don't leak resources
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Feb 6, 2024
1 parent f0807dc commit 17498ff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/backend/gl/gl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,25 @@ void gl_deinit(struct gl_data *gd) {
gl_destroy_window_shader(&gd->base, gd->default_shader);
gd->default_shader = NULL;
}
glDeleteProgram(gd->dummy_prog);
if (gd->present_prog != gd->dummy_prog) {
glDeleteProgram(gd->present_prog);

Check warning on line 996 in src/backend/gl/gl_common.c

View check run for this annotation

Codecov / codecov/patch

src/backend/gl/gl_common.c#L996

Added line #L996 was not covered by tests
}
gd->dummy_prog = 0;
gd->present_prog = 0;

glDeleteProgram(gd->fill_shader.prog);
glDeleteProgram(gd->brightness_shader.prog);
glDeleteProgram(gd->shadow_shader.prog);
gd->fill_shader.prog = 0;
gd->brightness_shader.prog = 0;
gd->shadow_shader.prog = 0;

glDeleteTextures(1, &gd->default_mask_texture);
glDeleteTextures(1, &gd->back_texture);

glDeleteQueries(2, gd->frame_timing);

gl_check_err();
}

Expand Down

0 comments on commit 17498ff

Please sign in to comment.