From 7fea82f5346f1354eccb9124473dc5bf519a2c0c Mon Sep 17 00:00:00 2001 From: Martijn Versteegh Date: Wed, 7 Oct 2020 11:43:40 +0200 Subject: [PATCH] Properly cleanup all resources and remove some obsolete comments. --- demo/sdl2surface_rawfb/main.c | 8 +++----- demo/sdl2surface_rawfb/sdl2surface_rawfb.h | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/demo/sdl2surface_rawfb/main.c b/demo/sdl2surface_rawfb/main.c index 94808e7..2d3fa78 100644 --- a/demo/sdl2surface_rawfb/main.c +++ b/demo/sdl2surface_rawfb/main.c @@ -182,8 +182,6 @@ int main(int argc, char **argv) nk_sdlsurface_render(context, clear, 1); -// SDL_Rect rect = {100, 100, 200, 100}; -// SDL_FillRect(surface, &rect, 0x00FF00FF); SDL_Texture *tex = SDL_CreateTextureFromSurface(renderer, surface); @@ -191,13 +189,13 @@ int main(int argc, char **argv) SDL_RenderPresent(renderer); SDL_DestroyTexture(tex); - //sdl blit surface - // sdl_renderer present } nk_sdlsurface_shutdown(context); - //! todo destroy rest of state + SDL_FreeSurface(surface); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); } diff --git a/demo/sdl2surface_rawfb/sdl2surface_rawfb.h b/demo/sdl2surface_rawfb/sdl2surface_rawfb.h index 2db5ae3..0056448 100644 --- a/demo/sdl2surface_rawfb/sdl2surface_rawfb.h +++ b/demo/sdl2surface_rawfb/sdl2surface_rawfb.h @@ -999,9 +999,10 @@ NK_API void nk_sdlsurface_shutdown(struct sdlsurface_context *sdlsurface) { if (sdlsurface) { - nk_free(&sdlsurface->ctx); - NK_MEMSET(sdlsurface, 0, sizeof(struct sdlsurface_context)); - free(sdlsurface); + SDL_FreeSurface(sdlsurface->font_tex); + nk_free(&sdlsurface->ctx); + NK_MEMSET(sdlsurface, 0, sizeof(struct sdlsurface_context)); + free(sdlsurface); } }