Access Violation by fox toolkit in FXObject::MetaClass::search(FXSelector key)

P

Pete

Well I've been sat here for hours twiddling with this code and it's
time to scream for help.

Hi there I'm a Student at Sheffield University programming the mapping
section of a control system for a flight simulator.
In order to do the graphical part required for the map we have an fox
declared window with an OpenGL canvas in it (loosely based on the
glviewer example which you get with the Fox toolkit download).
Things have been going hunky-dory so far but now im stuck with this
problem: When I inluded my most recent bit of code which loads Bitmaps
into OpenGL and declares them as textures I've been getting a:
0xC0000005: Access Violation from:

// Find function
const void* FXMetaClass::search(FXSelector key) const {
register const FXObject::FXMapEntry* lst=(const
FXObject::FXMapEntry*)assoc;
register FXuint n=nassocs;
while(n--){
//THE FOLLOWING LINE OF CODE:
if(lst->keylo<=key && key<=lst->keyhi) return lst;
lst=(const FXObject::FXMapEntry*) (((const FXchar*)lst)+assocsz);
}
return NULL;
}

If you already know exactly what the problem is GREAT! I'd really
appreciate if you could get back to me as soon as possible. If however
you need a bit more info then read on as I'v included the bit of code
that defines the textures:

if ((TextureImage[0]=LoadBMP("COMPASS ROSE.bmp")) && //Load those
bitmaps!
(TextureImage[1]=LoadBMP("RUNWAY.bmp")) &&
(TextureImage[2]=LoadBMP("VOR.bmp")) &&
(TextureImage[3]=LoadBMP("ILS and ILS-DME.bmp")) &&
(TextureImage[4]=LoadBMP("NDB.bmp")) &&
(TextureImage[5]=LoadBMP("DME.bmp")) &&
(TextureImage[6]=LoadBMP("TAC.bmp")) &&
(TextureImage[7]=LoadBMP("VOR-DME.bmp")))
{
Status=TRUE; // Set The Status To TRUE glGenTextures(8,
&texture[0]); // Create 8 Textures

for (int loop=0; loop<1; loop++) // Loop Through All 8 Textures
{
glBindTexture(GL_TEXTURE_2D, texture[loop]);



glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[loop]->sizeX,
TextureImage[loop]->sizeY, GL_RGB, GL_UNSIGNED_BYTE,
TextureImage[loop]->data);
}
}

for (int loop=0; loop<1; loop++) // Loop Through All 8
Textures
{
if (TextureImage[loop]) // If Texture Exists
{
if (TextureImage[loop]->data) // If Texture Image Exists
{
free(TextureImage[loop]->data); // Free The Texture Image
Memory
}
free(TextureImage[loop]); // Free The Image Structure
}
}


Sorry about the length of this enquiry I just wanted to make sure I
included as much info as possible, if I'v missed anything you need to
know please dont hesitate to ask. Thanks a lot

Pete

p.s HEEEEEEEEEELLLLLPPP!!!!!!!!!!!!!!!!!
 
R

red floyd

Pete said:
0xC0000005: Access Violation from:

// Find function
const void* FXMetaClass::search(FXSelector key) const {
register const FXObject::FXMapEntry* lst=(const
FXObject::FXMapEntry*)assoc;
register FXuint n=nassocs;
while(n--){
//THE FOLLOWING LINE OF CODE:
if(lst->keylo<=key && key<=lst->keyhi) return lst;
lst=(const FXObject::FXMapEntry*) (((const FXchar*)lst)+assocsz);
}
return NULL;

My lst is in invalid pointer. Make sure that lst points to a valid object.

I also suggest you read the FAQ on how to post... you need to post a
minimal complete compilable example that demonstrates the issue.

However, given the error message, I'd check the value of assoc, and
nassoc. I'd also skip the register declaration, the compiler is
probably ignoring it anyways.
 
P

Phlip

Pete said:
Well I've been sat here for hours twiddling with this code and it's
time to scream for help.

Please post this to a FOX mailing list. This newsgroup only discusses raw
C++ itself. I would bet that several here have read your code, looking for
some obvious C++ problem, such as a stray pointer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top