From: Laszlo T. <ave...@us...> - 2004-10-11 17:50:25
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17398 Modified Files: CharAnimations.cpp CharAnimations.h GameScript.cpp Interface.cpp Log Message: fixed a leak in CharAnimations (it will release the avatar table upon exit) Index: GameScript.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.cpp,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -d -r1.204 -r1.205 *** GameScript.cpp 9 Oct 2004 18:51:12 -0000 1.204 --- GameScript.cpp 11 Oct 2004 17:50:00 -0000 1.205 *************** *** 5440,5443 **** --- 5440,5444 ---- if(!Sender->CutSceneId) { printMessage("IEScript","Failed to set CutSceneID!\n",YELLOW); + abort(); } } Index: Interface.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Interface.cpp,v retrieving revision 1.222 retrieving revision 1.223 diff -C2 -d -r1.222 -r1.223 *** Interface.cpp 9 Oct 2004 16:31:07 -0000 1.222 --- Interface.cpp 11 Oct 2004 17:50:00 -0000 1.223 *************** *** 161,164 **** --- 161,166 ---- Interface::~Interface(void) { + CharAnimations::ReleaseMemory(); + if (TooltipBack) { for(int i=0;i<3;i++) { Index: CharAnimations.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/CharAnimations.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** CharAnimations.cpp 2 Oct 2004 13:05:09 -0000 1.45 --- CharAnimations.cpp 11 Oct 2004 17:50:00 -0000 1.46 *************** *** 25,30 **** #include "Interface.h" - extern Interface* core; - static int AvatarsCount = 0; static AvatarStruct *AvatarTable = NULL; --- 25,28 ---- *************** *** 32,35 **** --- 30,41 ---- static int SixteenToFive[16]={0,0,1,1,2,2,3,3,4,4,3,3,2,2,1,1}; + void CharAnimations::ReleaseMemory() + { + if (AvatarTable) { + free(AvatarTable); + AvatarTable=NULL; + } + } + int CharAnimations::GetAvatarsCount() { *************** *** 203,217 **** while (AvatarsRowNum--) { if (AvatarTable[AvatarsRowNum].AnimID==AnimID) { ! break; } } ! if (AvatarsRowNum == ~0u) { ! char tmp[256]; ! sprintf(tmp, "Invalid or nonexistent avatar entry:%04X\n", AnimID); ! printMessage("CharAnimations",tmp, LIGHT_RED); ! return; ! } ! ! SetArmourLevel( ArmourLevel ); } --- 209,219 ---- while (AvatarsRowNum--) { if (AvatarTable[AvatarsRowNum].AnimID==AnimID) { ! SetArmourLevel( ArmourLevel ); ! return; } } ! char tmp[256]; ! sprintf(tmp, "Invalid or nonexistent avatar entry:%04X\n", AnimID); ! printMessage("CharAnimations",tmp, LIGHT_RED); } Index: CharAnimations.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/CharAnimations.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CharAnimations.h 26 Aug 2004 14:07:33 -0000 1.29 --- CharAnimations.h 11 Oct 2004 17:50:00 -0000 1.30 *************** *** 124,127 **** --- 124,128 ---- CharAnimations(unsigned int AnimID, ieDword ArmourLevel); ~CharAnimations(void); + static void ReleaseMemory(); Animation* GetAnimation(unsigned char Stance, unsigned char Orient); |