From a98cf4ddd85306369e678051b9eea7be709c6956 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 23 Jan 2010 15:16:52 +0000 Subject: [PATCH] Do SDL quit and free surfaces --- gui.cpp | 20 ++++++++++++++++++++ main.cpp | 2 ++ sdl_ttf_font.hh | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gui.cpp b/gui.cpp index 6730d04..733613f 100644 --- a/gui.cpp +++ b/gui.cpp @@ -117,6 +117,26 @@ Gui::~Gui() if (VirtualKeyboard::kbd) delete VirtualKeyboard::kbd; + + SDL_FreeSurface(this->bg_left); + SDL_FreeSurface(this->bg_middle); + SDL_FreeSurface(this->bg_right); + SDL_FreeSurface(this->bg_submenu_left); + SDL_FreeSurface(this->bg_submenu_middle); + SDL_FreeSurface(this->bg_submenu_right); + SDL_FreeSurface(this->background); + SDL_FreeSurface(this->main_menu_bg); + SDL_FreeSurface(this->infobox); + SDL_FreeSurface(this->dialogue_bg); + SDL_FreeSurface(this->disc_info); + SDL_FreeSurface(this->textbox); + SDL_FreeSurface(this->selected_key); + SDL_FreeSurface(this->highlighted_key); + + if (this->default_font) + delete this->default_font; + if (this->small_font) + delete this->small_font; } bool Gui::setTheme(const char *path) diff --git a/main.cpp b/main.cpp index 93fbd0d..10b24eb 100644 --- a/main.cpp +++ b/main.cpp @@ -63,5 +63,7 @@ int main(int argc, char *argv[]) run(); fini(); + SDL_Quit(); + return 0; } diff --git a/sdl_ttf_font.hh b/sdl_ttf_font.hh index 7b21d1f..84fd843 100644 --- a/sdl_ttf_font.hh +++ b/sdl_ttf_font.hh @@ -19,7 +19,7 @@ public: ~Font_TTF() { - free(this->font); + TTF_CloseFont(this->font); } int getHeight(const char *str)