Don't crash if the current render target is destroyed.
This commit is contained in:
parent
852321d7a2
commit
1bcb90ff25
1 changed files with 6 additions and 1 deletions
|
@ -1691,9 +1691,14 @@ SDL_DestroyTexture(SDL_Texture * texture)
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
|
|
||||||
CHECK_TEXTURE_MAGIC(texture, );
|
CHECK_TEXTURE_MAGIC(texture, );
|
||||||
texture->magic = NULL;
|
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
|
if (texture == renderer->target) {
|
||||||
|
SDL_SetRenderTarget(renderer, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
texture->magic = NULL;
|
||||||
|
|
||||||
if (texture->next) {
|
if (texture->next) {
|
||||||
texture->next->prev = texture->prev;
|
texture->next->prev = texture->prev;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue