Properly cleanup all resources and remove some obsolete comments.

This commit is contained in:
Martijn Versteegh 2020-10-07 11:43:40 +02:00
parent dc635effbc
commit 7fea82f534
2 changed files with 7 additions and 8 deletions

View File

@ -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);
}

View File

@ -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);
}
}