Skip to content

Commit

Permalink
Finish any drawing when destroying a software renderer
Browse files Browse the repository at this point in the history
Fixes the SDL3 version of libsdl-org/sdl2-compat#373
  • Loading branch information
slouken committed Feb 20, 2025
1 parent 1a85397 commit 8f4c5e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/render/SDL_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -5214,7 +5214,12 @@ void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer)
SDL_RemoveWindowRenderer(renderer->window, renderer);
}

SDL_DiscardAllCommands(renderer);
if (renderer->software) {
// Make sure all drawing to a surface is complete
FlushRenderCommands(renderer);
} else {
SDL_DiscardAllCommands(renderer);
}

if (renderer->debug_char_texture_atlas) {
SDL_DestroyTexture(renderer->debug_char_texture_atlas);
Expand Down

3 comments on commit 8f4c5e1

@sezero
Copy link
Contributor

@sezero sezero commented on 8f4c5e1 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing...

@slouken
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, investigating.

@sezero
Copy link
Contributor

@sezero sezero commented on 8f4c5e1 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the else should be removed?

Please sign in to comment.