Skip to content

Commit

Permalink
Fixed texture destroy data bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardodoria committed Dec 28, 2023
1 parent bfcc36a commit 454301d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions engine/core/texture/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,19 @@ bool Texture::load(){
}

void Texture::destroy(){
if (!id.empty() && render){
if (!id.empty()){

render.reset();
render = NULL;
TexturePool::remove(id);
if (render) {
render.reset();
render = NULL;
TexturePool::remove(id);
}

data.reset();
data = NULL;
TextureDataPool::remove(id);
if (data) {
data.reset();
data = NULL;
TextureDataPool::remove(id);
}

if (!framebuffer){
needLoad = true;
Expand Down

0 comments on commit 454301d

Please sign in to comment.