SDLPP: Save texture before rendering

In some cases texture might be changed after render() has been called
but before renderer presented the render, causing errors.
This commit is contained in:
2021-01-30 21:24:54 +01:00
parent b65b0bf034
commit 1f7a80d7d2
4 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -55,7 +55,8 @@ Texture::Texture( std::shared_ptr< Renderer > &renderer, Font &font,
setTextureFromSurface( renderer, surface );
}
Texture::~Texture() {
SDL_DestroyTexture( texture );
if ( texture != nullptr )
SDL_DestroyTexture( texture );
}
SDL_Texture *Texture::getTexturePtr() {
return texture;