Public Group

# Unhandled exception. Access violation reading location

This topic is 2947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Breaks on this:

Pushed->subscribeEvent(PushButton::EventMouseClick, Event::Subscriber(&GameOptions::Pushed, this));

Hmm...I wonder why :\

##### Share on other sites
First thing I would check is that the Pushed pointer is pointing at something valid

##### Share on other sites
EDIT: Solved! Had to update CEGUI

##### Share on other sites
That is the definition of the GameOptions::Pushed method (event handler?).

I think pulpfist was asking for the Pushed in front of the "->" operator.

##### Share on other sites

That is the definition of the GameOptions::Pushed method (event handler?).

I think pulpfist was asking for the Pushed in front of the "->" operator.

Ah sorry, a little burnt out from looking at the screen for hours.

Pushed = GameOptionsWindow->getChild("GameOptions/Button/Continue");

And yes, the layout exists and is setup correctly :\

##### Share on other sites

That is the definition of the GameOptions::Pushed method (event handler?).

I think pulpfist was asking for the Pushed in front of the "->" operator.

Thats right.

The error indicates accessing a NULL or a stray pointer.

##### Share on other sites

[quote name='brx' timestamp='1317122002' post='4866391']
That is the definition of the GameOptions::Pushed method (event handler?).

I think pulpfist was asking for the Pushed in front of the "->" operator.

Ah sorry, a little burnt out from looking at the screen for hours.

Pushed = GameOptionsWindow->getChild("GameOptions/Button/Continue");

And yes, the layout exists and is setup correctly :\
[/quote]

Have you checked that Pushed is valid using the debugger?

##### Share on other sites
EDIT: Solved! Had to update CEGUI

##### Share on other sites
Hmm..
All I remember of CEGui was that it was a pain to make it work.

It looks like others have had problems with subscribeEvent before:

http://www.cegui.org.uk/phpBB2/viewtopic.php?f=2&t=1670
http://www.crystalspace3d.org/forum/index.php?topic=1596.0

That last link suggests that the code in the Pushed handler is making problems. You could try to out comment this line
CScene::GS().PostEvent(SC_EVENT_OPTIONS_STOP);
and see if that changes anything.

If you are using Visual C++ you can set a breakpoint at some line by left clicking at the left side of the line. You should see a red circle.
Then, when you run the project using the debug menu option, it should halt at the line with the breakpoint, and you should be able to hover the mouse over the variables and pointers to inspect their values and addresses. Maybe that could give you a hint of what is wrong.

Other than that, its hard to say without having the debugger in front to me.

Maybe someone with more experience with CEGui can help...

##### Share on other sites
I found something in this blog that might be relevant:

[color=#444444]When working on the GUI (CEGUI) that really came back and bit us in the ass. All was well untill I tried to add event handling with the subscribeEvent method.Bang! Access Violation! And since I was not linking to the debug version of the CEGUI library, I was left in the dark figuring out what just happened. After some time (way to much time) I eventually had the epiphany to google the segfault.

The reason for the access violation was that I was running my application in debug mode, and were linking to the CEGUI release mode libraries (asexplained in this CEGUI forum post). So now I had the motivation to get Visual Studio to link to the correct libraries based on the chosen configuration.

[/quote]

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 12
• 9
• 11
• 15