Game Development Community

Wierd crash

by Snowman · in Torque Game Engine · 12/01/2001 (11:54 pm) · 11 replies

Hi, I'm having a wierd crash now every time I exit my program. It's rather upsetting.

It comes about in the void TerrainRender::shutdown()
function in engine\terrain\terrRender.cc The program ends up having an access violation.

When I debug and see what it going on, the error comes about from the delete mBlendBitmap; So, I commented that line out and it exits fine. Obviously, this is a major hack that cannot be aloud.

Where can that variable be getting messed up? I don't touch any of terrain code, so I don't understand. When I look at the variable before deleting, it looks fine, although the pBits = "yyyyyyyyyyyyyyyyyyy" (with the litte dots on top. Not sure if that's bad or good. And pPallete is equal to 0x0000000

Other than that, the variable seems in tact. When it gives me the access vio, it spits me out to platformMemory.cc and points to this line:

if (next && next->flags == 0)

I'm not sure if that is any help.

Anyway, I don't know how else to debug. I'm stuck

Any help would be great! Thanks!

-Snowman

#1
12/02/2001 (2:38 am)
Do you use Windows 98??
#2
12/02/2001 (12:29 pm)
No, I'm using Windows 2000.

Any ideas?

-Snowman
#3
12/02/2001 (12:37 pm)
In terrRender.cc, line 231:
void TerrainRender::shutdown()
{
   delete mBlendBitmap;
   mBlendBitmap = NULL;
   flushCache();
}

Shazbot! Try this:

void TerrainRender::shutdown()
{
   if( mBlendBitmap )
   {
      delete mBlendBitmap;
      mBlendBitmap = NULL;
   }
   flushCache();
}
#4
12/02/2001 (12:47 pm)
I have tried that and it doesn't work because at the time of delete, mBlendBitmap is not equal to NULL. It has an address...

=(

Any more thoughts?

-Snowman
#5
12/02/2001 (1:16 pm)
I'm debugging right now, but I haven't found anything useful. When it is created, mBlendBitmap fills up perfectly fine, stored at address 0x0149ea80.

By the time I get to the delete call, everything is still in tact. All of the members still have the same data and point to the same spot, and the address is the same.

I hit F11 and try to step in, but it doesn't let me and ends with an access violation. So, I decided to do it myself. Stepping through the delete function, I end up in platformmemory.cc at approx line 900. Everything goes smoothly until I run into this:

#ifdef DEBUG
dMemset(mem, 0xCE, hdr->size);
#endif

I'm not sure what it's doing or why it's doing it, but it's messing up the contents of mem (the data at the address of the mBlendBitmap I was trying to delete).

Looking higher, hdr is set like this:

AllocatedHeader *hdr = ((AllocatedHeader *)mem) - 1;

That sets the pointer to point at the address, 0x0149ea70. I have a feeling that's not good, as it is out of the constraints of the data which is located at 0x0149ea80, but I don't know.

Let me know if anyone has any suggestions!

Thanks!

-Snowman

EDIT: hdr->Size is equal to 80...
#6
12/02/2001 (1:32 pm)
Hard to debug something without knowing anything about the changes. Sometimes when I merge changes from the Torque with my game, I get strange crashes. Lately it's been from the terrain renderer changes, and after much frustration I found that doing a full rebuild solved the problem.
#7
12/02/2001 (2:42 pm)
Yeah, I tried a full rebuild, but unfortunately I didn't get the error fixed =(

I haven't made many changes between when it did work and now, when it doesn't work. I don't think that my changes could really have affected it too much. It seems like an isolated area, where I have not touched the code.

Anyway, I'll keep trying. Let me know if you can think of anything else.

-Snowman
#8
12/02/2001 (3:28 pm)
Have you tried looking higher up the call stack to see if it leads to any modifications?

I don't know the Torque code nearly well enough (yet ;-) to help beyond general suggestions.
#9
12/02/2001 (3:32 pm)
Two questions. Did you delete all your .dso's after the rebuild to make sure that you don't accidently have one pointing at something it shouldn't? Second, is it possible that the blend function is looking for a texture that has been changed - perhaps it's no longer a power of two or alpha is no longer part of the texture?
#10
12/02/2001 (6:57 pm)
Ok, I tried looking way back on the call stack, but there wasn't anything interesting that I saw (Just standard shutdown stuff...)

I have deleted all dso and all ml files along with the rebuild all. That unfortunately yeilds the same result.

As for it being a texture, I suppose it is a possibility, though I don't know what the blend bitmap is and it doesn't appear to be loading a specific file. Plus, this happens no matter I enter a mission or not...

I know it's going to end up being something silly, like I put a ; in where I shouldn't have or something.

Thanks for the suggestions so far though!

-Snowman
#11
12/02/2001 (9:34 pm)
Well, I got it working. On a suggestion from _|moomoo|_ (fred), I updated my video drivers to the latest Nvidia Detonator drivers. The error went away.

Also, on a suggestion from Rick I ran with -console and it worked (both before and after updating the drivers). But, now it works without -console as well.

Thanks to all that helped!

-Snowman