Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showimage leaks renderer and doesn't call SDL_VideoQuit #104

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

showimage leaks renderer and doesn't call SDL_VideoQuit #104

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.1
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2016-03-15 18:11:45 +0000, Juha Niemimäki wrote:

I was testing SDL_image2 on AmigaOS 4 platform. Noticed a couple of issues with 'showimage' tool:

  1. SDL_VideoInit seems to be called implicitly via window creation. SDL_Quit doesn't call SDL_VideoQuit so it doesn't close video device, windows etc. properly. Proposal: add SDL_Init(SDL_INIT_VIDEO) in the beginning for symmetrical video init/deinit.

  2. Renderer is not destroyed at the end. As far as I know SDL2 doesn't automatically delete renderers. Proposal: add SDL_DestroyRenderer(renderer) at the end.

On 2017-09-11 19:48:22 +0000, Sylvain wrote:

Small patch for this:

--- a/showimage.c Sat Sep 09 18:57:05 2017 -0700
+++ b/showimage.c Mon Sep 11 21:47:56 2017 +0200
@@ -76,6 +76,11 @@
}
}

  • if (SDL_Init(SDL_INIT_VIDEO) == -1) {

  •    fprintf(stderr, "SDL_Init(SDL_INIT_VIDEO) failed: %s\n", SDL_GetError());
    
  •    return(2);
    
  • }

  • if (SDL_CreateWindowAndRenderer(0, 0, flags, &window, &renderer) < 0) {
    fprintf(stderr, "SDL_CreateWindowAndRenderer() failed: %s\n", SDL_GetError());
    return(2);
    @@ -169,6 +174,10 @@
    SDL_DestroyTexture(texture);
    }

  • SDL_DestroyRenderer(renderer);

  • SDL_DestroyWindow(window);

  • /* We're done! */
    SDL_Quit();
    return(0);

On 2017-09-12 04:23:18 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL_image/rev/28967769bc2e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant