access violation when subscribing event

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

billconan
Just popping in
Just popping in
Posts: 12
Joined: Wed May 17, 2006 14:11

access violation when subscribing event

Postby billconan » Sat Jun 24, 2006 06:13

Unhandled exception at 0x0041231c in P.exe: 0xC0000005: Access violation reading location 0xbaadf008.

Code: Select all

bool allOver(const CEGUI::EventArgs& e)
{
   exit(0);
   return true;
}


Code: Select all

FrameWindow* theMainFrame=static_cast<FrameWindow*>(wmgr.createWindow("PolygonStudio/FrameWindow", "mainFrame"));
myRoot->addChildWindow(theMainFrame);
theMainFrame->subscribeEvent(FrameWindow::EventCloseClicked, &allOver);

enkd
Just popping in
Just popping in
Posts: 5
Joined: Thu Jul 06, 2006 21:59

Postby enkd » Fri Jul 07, 2006 00:05

Make sure that you built CEGUI against the same version of STL or STLport that your application uses. I had the same problem, access violation calling subscribeEvent.

My problem was that I built CEGUI against STL, and my application used STLport. As such, any CEGUI class which used standard library data members would be corrupted upon returing from CEGUI calls. For example, all was fine inside WindowManager::createWindow, but back in MY code, the Window was corrupted. This caused an invalid __vfptr (virtual function table pointer) and an access violation on the subscribeEvent call.

An easy check for this is to evaluate sizeof(CEGUI::EventSet) in the debugger, both when inside a CEGUI call and in your own code. The numbers shoud match. If not:

check your includes and rebuild CEGUI with STLport (if you use it)
also, be sure to include the preprocessor directive _STLP_DEBUG if you are using a debug build.

billconan
Just popping in
Just popping in
Posts: 12
Joined: Wed May 17, 2006 14:11

Postby billconan » Fri Sep 01, 2006 17:26

enkd wrote:Make sure that you built CEGUI against the same version of STL or STLport that your application uses. I had the same problem, access violation calling subscribeEvent.

My problem was that I built CEGUI against STL, and my application used STLport. As such, any CEGUI class which used standard library data members would be corrupted upon returing from CEGUI calls. For example, all was fine inside WindowManager::createWindow, but back in MY code, the Window was corrupted. This caused an invalid __vfptr (virtual function table pointer) and an access violation on the subscribeEvent call.

An easy check for this is to evaluate sizeof(CEGUI::EventSet) in the debugger, both when inside a CEGUI call and in your own code. The numbers shoud match. If not:

check your includes and rebuild CEGUI with STLport (if you use it)
also, be sure to include the preprocessor directive _STLP_DEBUG if you are using a debug build.


i did not build cegui myself, i downloaded the installer

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sat Sep 02, 2006 15:13

On which line does the exception get thrown? Is it actually when subscribing or when the event is fired?

A full debug callstack at the point of the exception would be most useful :)

CE.

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Sat Sep 02, 2006 19:15

Just recovered from here and now having exactly the same issue :(

The whole app crashes here

Code: Select all

mGUISystem->injectMouseButtonUp((CEGUI::MouseButton)i);
but only if i subscribe to an event before. I am also using the CEGUI Version coming with Ogre 1.22.

Full Debug Callstack? How do I get one? Everything looking like "callstack" in the Visual Studio Express Debug IDE is

Code: Select all

>   GSS - Projekt.exe!InputManager::injectToCeGUI()  Line 21 + 0xe bytes   C++
    GSS - Projekt.exe!GsLogin::render()  Line 60   C++
    GSS - Projekt.exe!StateManager::render()  Line 54 + 0x20 bytes   C++
    GSS - Projekt.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * hPrevInst=0x00000000, char * lpCmdLine=0x00151f13, int nCmdShow=1)  Line 76   C++
    GSS - Projekt.exe!__tmainCRTStartup()  Line 578 + 0x35 bytes   C
    GSS - Projekt.exe!WinMainCRTStartup()  Line 403   C
    kernel32.dll!7c816d4f()    
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]   
    kernel32.dll!7c8399f3()    


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 12 guests