Flush rendering if a texture palette is in use when destroyed

This commit is contained in:
Sam Lantinga
2025-10-10 17:04:45 -07:00
parent 3fcac8cc44
commit 9d635fe641

View File

@@ -1941,6 +1941,7 @@ bool SDL_SetTexturePalette(SDL_Texture *texture, SDL_Palette *palette)
// Clean up the texture palette
--texture->palette->refcount;
if (texture->palette->refcount == 0) {
FlushRenderCommandsIfPaletteNeeded(renderer, texture->palette);
renderer->DestroyPalette(renderer, texture->palette);
SDL_RemoveFromHashTable(renderer->palettes, texture->public_palette);
}