From: Matthias Braun Date: Thu, 29 Apr 2004 16:23:32 +0000 (+0000) Subject: another leak fix for the leveleditor X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=348bceff3b07ba365d6815a00deee385e25d0962;p=supertux.git another leak fix for the leveleditor SVN-Revision: 847 --- diff --git a/src/level.cpp b/src/level.cpp index d5e3e722f..d8880da24 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -43,7 +43,7 @@ LevelSubset::LevelSubset() LevelSubset::~LevelSubset() { - delete image; + delete image; } void LevelSubset::create(const std::string& subset_name) @@ -221,7 +221,7 @@ Level::Level(const std::string& filename) Level::~Level() { - free_gfx(); + delete img_bkgd; } void @@ -634,20 +634,16 @@ Level::load_gfx() snprintf(fname, 1024, "%s/background/%s", st_dir, bkgd_image.c_str()); if(!faccessible(fname)) snprintf(fname, 1024, "%s/images/background/%s", datadir.c_str(), bkgd_image.c_str()); + delete img_bkgd; img_bkgd = new Surface(fname, IGNORE_ALPHA); } else { + delete img_bkgd; img_bkgd = 0; } } -void -Level::free_gfx() -{ - delete img_bkgd; -} - /* Load a level-specific graphic... */ void Level::load_image(Surface** ptexture, string theme,const char * file, int use_alpha) diff --git a/src/level.h b/src/level.h index 2c4fc600b..682cbe6c9 100644 --- a/src/level.h +++ b/src/level.h @@ -115,7 +115,6 @@ class Level int load(const std::string& filename); void load_gfx(); - void free_gfx(); void load_song(); void free_song(); diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index cfa6a5e05..a77371838 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -367,7 +367,6 @@ int leveleditor(int levelnb) flipscreen(); } - le_quit(); return done; } @@ -578,7 +577,6 @@ void apply_level_settings_menu() if(i) { - le_current_level->free_gfx(); le_current_level->load_gfx(); } @@ -618,7 +616,6 @@ void le_goto_level(int levelnb) le_set_defaults(); - le_current_level->free_gfx(); le_current_level->load_gfx(); le_world.activate_bad_guys(); @@ -655,6 +652,8 @@ void le_quit(void) delete le_current_level; le_current_level = 0; + delete le_level_subset; + le_level_subset = 0; for(TileGroupsMap::iterator i = tilegroups_map.begin(); i != tilegroups_map.end(); ++i)