Fix double free, null texture drop
authorkwolekr <kwolekr@minetest.net>
Fri, 12 Apr 2013 21:20:05 +0000 (17:20 -0400)
committerkwolekr <kwolekr@minetest.net>
Fri, 12 Apr 2013 21:20:05 +0000 (17:20 -0400)
src/emerge.cpp
src/tile.cpp

index 9d3f94d48428f5d9a97a86af268b7c0783d5592c..049b3cc1276443b04910d3fc32e84f856c9cd661 100644 (file)
@@ -97,9 +97,6 @@ EmergeManager::~EmergeManager() {
                delete mapgen[i];
        }
        emergethread.clear();
-
-       for (unsigned int i = 0; i < mapgen.size(); i++)
-               delete mapgen[i];
        mapgen.clear();
 
        for (unsigned int i = 0; i < ores.size(); i++)
index 3bfb4bb884dac075f075c80ed70eea2b35faf4b6..39f47962e9da676f07fd09c5216b08ff0499f984 100644 (file)
@@ -480,7 +480,8 @@ TextureSource::~TextureSource()
                        driver->removeTexture(t);
 
                //cleanup source image
-               iter->atlas_img->drop();
+               if (iter->atlas_img)
+                       iter->atlas_img->drop();
        }
        m_atlaspointer_cache.clear();