hedgewars/uLand.pas
changeset 769 788efc1d649f
parent 768 2886dafa5bcf
child 797 e7fa1a1b9791
--- a/hedgewars/uLand.pas	Sun Jan 27 19:29:00 2008 +0000
+++ b/hedgewars/uLand.pas	Sun Jan 27 20:35:40 2008 +0000
@@ -640,6 +640,7 @@
    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]);
    end else
    begin
+   TryDo(LandSurface <> nil, 'Assert (LandSurface <> nil) failed', true);
    LandTexture:= Surface2Tex(LandSurface);
 
    if SDL_MustLock(LandSurface) then
@@ -648,7 +649,10 @@
    Move(LandSurface^.pixels^, LandPixels, 2048 * 1024 * 4);
 
    if SDL_MustLock(LandSurface) then
-      SDL_UnlockSurface(LandSurface)
+      SDL_UnlockSurface(LandSurface);
+
+   SDL_FreeSurface(LandSurface);
+   LandSurface:= nil
    end;
 
 end;