SubscribeEvent Errors

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

User avatar
charmy
Just popping in
Just popping in
Posts: 8
Joined: Fri May 06, 2005 20:43

SubscribeEvent Errors

Postby charmy » Fri May 06, 2005 20:49

Greetings,

Having a small issue with subscribing events to an edit box, sadly there is no error output, its a memeory access error, however when I run the debugger the line it crashes on is the following.


Code: Select all

wMgr.getWindow("Input")->subscribeEvent(Editbox::EventTextAccepted,CEGUI::Event::Subscriber(&slGuiManager::handleInput, this));


I thought the format was correct but for some reason its causing a crash.
If i comment this line the program loads fine.


Here is a snippit of the surrounding code.

Code: Select all

   //WindowManager& wMgr = WindowManager::getSingleton();
    Editbox* ebox = (Editbox*)wMgr.createWindow("TaharezLook/Editbox","Input");
   console->addChildWindow(ebox);
   ebox->setPosition(Point(.05, .81));
   ebox->setSize(Size(.9, .19));
wMgr.getWindow("Input")->subscribeEvent(CEGUI::Editbox::EventTextAccepted,CEGUI::Event::Subscriber(&slGuiManager::handleInput, this));


The commented line is to show that i have infact set the reference of wMgr to the manager singleton earlier on.

And finally the event handler code.

Code: Select all

bool slGuiManager::handleInput(const CEGUI::EventArgs& e)
{
   return true;
}

yup it does alot ;)

Anyway this has be quite baffled and i am hoping someone can point me in the right direction with this one.

I appricate any help you can offer =).

Thanks Much.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: SubscribeEvent Errors

Postby lindquist » Fri May 06, 2005 23:29

try this instead:

Code: Select all

ebox->subscribeEvent(CEGUI::Editbox::EventTextAccepted,CEGUI::Event::Subscriber(handleInput, this));


you don't need to take the address of the handler function, and no need to use the window manager when you already have a pointer to the editbox.

User avatar
charmy
Just popping in
Just popping in
Posts: 8
Joined: Fri May 06, 2005 20:43

Re: SubscribeEvent Errors

Postby charmy » Sat May 07, 2005 04:23

Thanks for the response, however the same thing seems to be happeneing with that line of code.

I will continue to play around with it, but if anyone has any ideas why this might be, please let me know.

Thanks again =)

BTW i am using stlport 4.6.2 and this is with the ogre renderer.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: SubscribeEvent Errors

Postby lindquist » Sat May 07, 2005 12:52

hmm..
could you post your call stack ?

preferably in a code section

User avatar
charmy
Just popping in
Just popping in
Posts: 8
Joined: Fri May 06, 2005 20:43

Re: SubscribeEvent Errors

Postby charmy » Sat May 07, 2005 22:55

Surely, Here it is

Code: Select all

>   Demo_SkeletalAnimation.exe!CEGUI::slGuiManager::DebugConsole()  Line 88 + 0x31   C++
    Demo_SkeletalAnimation.exe!SkeletalApplication::createScene()  Line 249   C++
    Demo_SkeletalAnimation.exe!ExampleApplication::setup()  Line 95 + 0xd   C++
    Demo_SkeletalAnimation.exe!ExampleApplication::go()  Line 55 + 0xd   C++
    Demo_SkeletalAnimation.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00141f31, HINSTANCE__ * __formal=0x00000000)  Line 36 + 0x8   C++
    Demo_SkeletalAnimation.exe!WinMainCRTStartup()  Line 390 + 0x39   C
    kernel32.dll!7c816d4f()    
    kernel32.dll!7c8399f3()    


I will post the source in a few mins, its just a mod on the demo skeletal app. Don't know why i didn't just do that in the first place....

User avatar
charmy
Just popping in
Just popping in
Posts: 8
Joined: Fri May 06, 2005 20:43

Re: SubscribeEvent Errors

Postby charmy » Sat May 07, 2005 22:58

Here is the Source for the program, thanks again for all the help =)

User avatar
charmy
Just popping in
Just popping in
Posts: 8
Joined: Fri May 06, 2005 20:43

Re: SubscribeEvent Errors

Postby charmy » Sat May 07, 2005 23:55

Hmm Just found out that its only in the debug mode, it happens with the ogre GUI demo as well, so my libs must be corrupt or some such thing, Please if you would though test this source on your machine in debug mode to see if it gives you any problems.


Thank you again.


EDIT: Well it runs atleast until i try to excute the command, I have a feeling that the libs provided in the ogre package are corrupt in some way becuase i do not have these issues when i use the NeL Renderer.

Has anyone else had problems with edit boxes in the ogre renderer?

User avatar
charmy
Just popping in
Just popping in
Posts: 8
Joined: Fri May 06, 2005 20:43

Re: SubscribeEvent Errors

Postby charmy » Mon May 09, 2005 16:19

Anyone had a chance to test this yet??? I am still having the same issue.

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

Re: SubscribeEvent Errors

Postby billconan » Sat Jun 24, 2006 07:27

charmy wrote:Anyone had a chance to test this yet??? I am still having the same issue.


are you using vs2005?

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

Postby enkd » Fri Jul 07, 2006 00:07

I wrote this response for another thread, but I'm almost sure this is your problem... took me a couple of days to debug.

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.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests