crash in framelistener

mako

15-03-2007 15:59:17

well
my program crash in this line with an access violation error.

pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

it seems alright to me.

I'm using the BasicFrameLister that comes to the addon.


BasicFrameListener::BasicFrameListener( Ogre::RenderWindow* win, Ogre::SceneManager* mgr, OgreNewt::World* W, int update_framerate) :
FrameListener()
{
m_World = W;
desired_framerate = update_framerate;

m_update = (Ogre::Real)(1.0f / (Ogre::Real)desired_framerate);
m_elapsed = 0.0f;

// add the standard debug viewer.
Debugger::getSingleton().init( mgr );

OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;

win->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

mInputManager = OIS::InputManager::createInputSystem( pl );

//Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, false ));

}


I've verified that my mWindow, mScenemgr and mWorld is initialized


if(mWindow && mSceneMgr && mWorld)
mOgreNewtListener = new OgreNewt::BasicFrameListener(mWindow,mSceneMgr,mWorld, 30);


I don't have a clue of what is wrong. or for what kind of error I should look.

mako

15-03-2007 16:33:38

well,
I Have created my own FrameListener.
and have seen my application, but when I escape from the application, I got another error, this time in the debugger.

m_debugnode->detachAllObjects();

line 37 of OgreNewt_Debugger.cpp

What is my mistake?

P.S: I've commented the line to work it correctly, but I did not get why it wasnt working at all, if sum1 could explain, I'll be thankful.

nikhil

17-03-2007 08:11:40

are you using the OgreNewt debugger to show the Collision lines? if so, you've to deinitialize the debugger, possibly in the destructor of some frame listener or the main class.

add
OgreNewt::Debugger::getSingleton().deInit();
in the destructor of the main application class.

hope this helps..

nik

mako

19-03-2007 12:14:35

thanks bro, it worked =)

mako

19-03-2007 15:23:42

just to inform, it worked when I put OgreNewt_Main_d.lib and not OgreNewt_Main.lib
AND used the tip of nikhil (thanks again)

nikhil

21-03-2007 04:52:54

ur welcome... and yeah, it takes a while getting used to this linking/compiling stuff, especially if you are new to it.. i've had nightmarish times trying to get rid of them. just when you think you've been through it all, a new kind of problem will stare right back at your face..