fix double free bug

This commit is contained in:
scawful
2024-05-30 12:14:01 -04:00
parent 0f19fda556
commit ba1e2367bb

View File

@@ -68,7 +68,6 @@ class Bitmap {
*/ */
void Create(int width, int height, int depth, const Bytes &data); void Create(int width, int height, int depth, const Bytes &data);
/** /**
* @brief Creates the underlying SDL_Texture to be displayed. * @brief Creates the underlying SDL_Texture to be displayed.
* *
@@ -245,7 +244,6 @@ class Bitmap {
void operator()(SDL_Texture *p) const { void operator()(SDL_Texture *p) const {
if (p != nullptr) { if (p != nullptr) {
SDL_DestroyTexture(p); SDL_DestroyTexture(p);
p = nullptr;
} }
} }
}; };
@@ -254,7 +252,6 @@ class Bitmap {
void operator()(SDL_Surface *p) const { void operator()(SDL_Surface *p) const {
if (p != nullptr) { if (p != nullptr) {
SDL_FreeSurface(p); SDL_FreeSurface(p);
p = nullptr;
} }
} }
}; };