From def53bdd5d69d0742e761f8a27ee67e4dce1f49a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 10 May 2006 03:08:27 +0000 Subject: [PATCH] - Fixed?: WallSpriteColumn apparently needs to set dc_texturefrac. At least Valgrind seems to say so. - Fixed: The FWadCollection destructor needs to use free to free the LumpInfo and Wads arrays. - Fixed: The ColorMapKiller needs to use the delete[] form of delete. - Fixed: FConfigFile::ClearCurrentSection() should be calling the delete[] form of delete to free the entry. - Fixed: FPatchTexture::MakeTexture() does not need to blindly recreate the Spans if they already exist. - Fixed: The FMultiPatchTexture destructor did not call its Unload() method. - Restored the original padding calculation to FMultiPatchTexture::MakeTexture(). I believe the Valgrind errors were caused by accessing off the end of the screen buffer, not from accessing off the end of a texture. SVN r98 (trunk) --- docs/rh-log.txt | 13 +++++++++++++ src/configfile.cpp | 2 +- src/r_data.cpp | 13 +++++++++---- src/r_segs.cpp | 1 + src/w_wad.cpp | 4 ++-- zdoom.vcproj | 3 --- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 5182719ae..3b0165a94 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,17 @@ May 9, 2006 +- Fixed?: WallSpriteColumn apparently needs to set dc_texturefrac. At least + Valgrind seems to say so. +- Fixed: The FWadCollection destructor needs to use free to free the LumpInfo + and Wads arrays. +- Fixed: The ColorMapKiller needs to use the delete[] form of delete. +- Fixed: FConfigFile::ClearCurrentSection() should be calling the delete[] form + of delete to free the entry. +- Fixed: FPatchTexture::MakeTexture() does not need to blindly recreate the + Spans if they already exist. +- Fixed: The FMultiPatchTexture destructor did not call its Unload() method. +- Restored the original padding calculation to FMultiPatchTexture::MakeTexture(). + I believe the Valgrind errors were caused by accessing off the end of the + screen buffer, not from accessing off the end of a texture. - Backported the classnames-are-names changes from the FP code. - Backported the improved hierarchical dumpclasses command from the FP code. - Updated Jim's Makefile.linux. diff --git a/src/configfile.cpp b/src/configfile.cpp index 6c5a2430f..aac482c42 100644 --- a/src/configfile.cpp +++ b/src/configfile.cpp @@ -195,7 +195,7 @@ void FConfigFile::ClearCurrentSection () { next = entry->Next; delete[] entry->Value; - delete (char *)entry; + delete[] (char *)entry; entry = next; } CurrentSection->RootEntry = NULL; diff --git a/src/r_data.cpp b/src/r_data.cpp index 60eaf9370..d121d381d 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -1273,6 +1273,11 @@ void FPatchTexture::MakeTexture () } // Create the spans + if (Spans != NULL) + { + return; + } + Spans = (Span **)M_Malloc (sizeof(Span*)*Width + sizeof(Span)*numspans); spanstuffer = (Span *)((BYTE *)Spans + sizeof(Span*)*Width); warned = false; @@ -2152,6 +2157,7 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl FMultiPatchTexture::~FMultiPatchTexture () { + Unload (); if (Parts != NULL) { delete[] Parts; @@ -2227,8 +2233,7 @@ void FMultiPatchTexture::MakeTexture () { // Add a little extra space at the end if the texture's height is not // a power of 2, in case somebody accidentally makes it repeat vertically. - // (Jim's Valgrind dump indicates that more padding is needed here.) - int numpix = Width * Height + Height;// (1 << HeightBits) - Height; + int numpix = Width * Height + (1 << HeightBits) - Height; Pixels = new BYTE[numpix]; memset (Pixels, 0, numpix); @@ -2843,12 +2848,12 @@ static struct ColorMapKiller { if (fakecmaps != NULL) { - delete fakecmaps; + delete[] fakecmaps; fakecmaps = NULL; } if (realcolormaps != NULL) { - delete realcolormaps; + delete[] realcolormaps; realcolormaps = NULL; } } diff --git a/src/r_segs.cpp b/src/r_segs.cpp index b0f020202..c4f3d4ac0 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -2488,6 +2488,7 @@ static void WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTextur const BYTE *column; const FTexture::Span *spans; column = WallSpriteTile->GetColumn (texturecolumn, &spans); + dc_texturefrac = 0; drawfunc (column, spans); rw_light += rw_lightstep; } diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 6e3c57ebc..09c44b232 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -195,7 +195,7 @@ FWadCollection::~FWadCollection () delete[] LumpInfo[i].fullname; } } - delete[] LumpInfo; + free (LumpInfo); LumpInfo = NULL; } if (Wads != NULL) @@ -204,7 +204,7 @@ FWadCollection::~FWadCollection () { delete Wads[i]; } - delete[] Wads; + free (Wads); Wads = NULL; } } diff --git a/zdoom.vcproj b/zdoom.vcproj index 5b13149c2..550cc5639 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -4289,9 +4289,6 @@ - -