OSDN Git Service

GameSurfaceSDL::UpdateTimeStatus() のメモリリークバグを修正。 / Fix memory leak bug in GameSurface...
authorDeskull <desull@users.sourceforge.jp>
Tue, 13 Jan 2015 03:50:49 +0000 (12:50 +0900)
committerDeskull <desull@users.sourceforge.jp>
Tue, 13 Jan 2015 03:50:49 +0000 (12:50 +0900)
Deeangband/GameSurfaceSDL.cpp
lib-Vanilla/Dungeon.xml

index f7ddd24..45cf0f1 100644 (file)
@@ -383,19 +383,20 @@ namespace Deeangband
 
        void GameSurfaceSDL::UpdateTimeStatus(GAME_TIME currentTime)
        {
+
                SDL_Rect rect = {0, 0, 200, 50};
                SDL_Rect StatusViewRect = {0, 0, 200, 50};
                SDL_Rect StatusViewPosition = {10, 10, 0, 0};
                SDL_Surface *surface, *statusSurface;
                const int STATUS_BUFSIZE = 100;
                char statusBuf[STATUS_BUFSIZE];
-               //if(!gameTimeStatusSurface) SDL_FreeSurface(gameTimeStatusSurface);
+               if(gameTimeStatusTexture) SDL_DestroyTexture(gameTimeStatusTexture);
                surface = SDL_CreateRGBSurface(0, 200, 50, 32, 0, 0, 0, 0);
                SDL_FillRect(surface, &rect, SDL_MapRGBA(windowSurface->format, 0, 0, 0, 120));
                sprintf_s(statusBuf, STATUS_BUFSIZE, "\83^\81[\83\93:%d", currentTime); 
                statusSurface = TTF_RenderUTF8_Blended(font, toUTF8(statusBuf).c_str(), color);
                SDL_BlitSurface(statusSurface, &StatusViewRect, surface, &StatusViewPosition); 
-               SDL_CreateTextureFromSurface(renderer, surface);
+               gameTimeStatusTexture = SDL_CreateTextureFromSurface(renderer, surface);
                SDL_FreeSurface(statusSurface);
                SDL_FreeSurface(surface);
        }
index c703e46..ddf2070 100644 (file)
@@ -18,8 +18,8 @@
                                <ControllCamp></ControllCamp>
                                <GuardianSpecies></GuardianSpecies>
                                <BaseSize class_id="4" tracking_level="0" version="10">
-                                       <X>40</X>
-                                       <Y>40</Y>
+                                       <X>17</X>
+                                       <Y>23</Y>
                                </BaseSize>
                        </px>
                </second>