473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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_FILTE R,GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,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!!!!!!!!!!!!!!!!!

Apr 14 '06 #1
2 1783
Pete wrote:

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.

Apr 14 '06 #2
Pete wrote:
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.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.