Question

when I made my game, all went fine, but suddenly I had a weird exception on the load picture of soil. It didn't happened in the start of the game, it happened suddenly, it was very weird.

here a picture: http://oi39.tinypic.com/vgj9y.jpg

here the code:

bool window::loadTex(std::string fName, int fNum)
{
        textur[fNum] = SOIL_load_OGL_texture
            (
            (char*)fName.c_str(),
            SOIL_LOAD_AUTO,
            SOIL_CREATE_NEW_ID,
            SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y 
            );
        if(textur[fNum] == 0)
            return false;
        return true;
}

and the function call:

if(!loadTex(std::string("data/back.png"), 0))
        printf("Can't load image");

it is so weird... when the exception happened, I didn't do anything that related to soil.

There is more information about it in the Dissambly, may it help?

First-chance exception at 0x784FFDEE (msvcr100.dll) in ConsoleApplication6.exe: 0xC0000005: Access violation reading location 0x00000000.

Fixed! thanks a lot!

Was it helpful?

Solution

There's nothing weird about it. You have a run time error. Probably somewhere in your code you overrun some memory and this is the way the problem manifested itself. You need to find the problem in your code.

One way to find the problem is to look with the debugger what is wrong with objects where the crash is. Maybe one of the pointers there have invalid value. If the address of this pointer that has garbage in it is consistent between runs, you can put a data break point on its address and see, every time you hit the data break point, who is changing it and whether it's an error or normal healthy flow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top