Skip to content

Commit

Permalink
fix: free used textures
Browse files Browse the repository at this point in the history
  • Loading branch information
pathway27 committed Feb 18, 2018
1 parent 4582322 commit 2f2ef6b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
17 changes: 9 additions & 8 deletions src/bklayervita.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ void BKLayer::load() {
}

void BKLayer::unload(){
// bad crash if i do these?
// delete texLogo;
// delete bk_memory_icon;
// delete bk_battery_icon;
// delete bk_clock_icon;
// delete bk_circle_icon;
// delete bk_cross_icon;
// delete fontBig;
// do i need to do this?
// crashes if i do...
texLogo->release();
bk_memory_icon->release();
bk_battery_icon->release();
bk_clock_icon->release();
bk_circle_icon->release();
bk_cross_icon->release();
fontBig->release();
}

void BKLayer::drawImage(int x, int y) {
Expand Down
7 changes: 4 additions & 3 deletions src/bookr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ int main(int argc, char* argv[]) {
#endif
}

#ifdef DEBUG
#endif
#ifdef DEBUG
printf("exiting...\n");
#endif

// Get rid of all gui layers
bkLayersIt it(layers.begin());
Expand All @@ -275,8 +276,8 @@ int main(int argc, char* argv[]) {
}
layers.clear();

BKLayer::unload();
FZScreen::close();
BKLayer::unload();
FZScreen::exit();

return 0;
Expand Down
10 changes: 4 additions & 6 deletions src/graphics/fztexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,11 @@
#ifdef DEBUG
printf("~FZTexture\n");
#endif
if (texImage)
texImage->release();
texImage = NULL;

if (vita_texture)
vita2d_free_texture(vita_texture);
vita_texture = NULL;
if (vita_texture != NULL) {
vita2d_free_texture(vita_texture);
vita_texture = NULL;
}
}

void FZTexture::bind() {
Expand Down

0 comments on commit 2f2ef6b

Please sign in to comment.