|

楼主 |
发表于 2011-9-27 04:03:00
|
显示全部楼层
Re:DEBUG模式转RELEASE模式的问题
又追踪了一下程序 发现问题可能出现在这段代码上
initOgre(Ogre::String wndTitle, OIS::KeyListener *pKeyListener, OIS::MouseListener *pMouseListener){
Ogre: ogManager* logMgr = new Ogre::LogManager();
m_pLog = Ogre::LogManager::getSingleton().createLog("Log.log",true, true, false);
m_pLog->setDebugOutputEnabled(true);
m_pRoot = new Ogre::Root();
m_pRoot->showConfigDialog();
m_pRenderWnd = m_pRoot->initialise(true,wndTitle);
unsigned long hWnd = 0;
OIS: aramList paramList;
m_pRenderWnd->getCustomAttribute("WINDOW", &hWnd);
paramList.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
m_pInputMgr = OIS::InputManager::createInputSystem(paramList);
m_pKeyboard = static_cast<OIS::Keyboard*>(m_pInputMgr->createInputObject(OIS::OISKeyboard, false));
m_pMouse = static_cast<OIS::Mouse*>(m_pInputMgr->createInputObject(OIS::OISMouse,true));
m_pMouse->getMouseState().height = m_pRenderWnd->getHeight();
m_pMouse->getMouseState().width = m_pRenderWnd->getWidth();
if(pKeyListener == 0)
m_pKeyboard->setEventCallback(this);
else
m_pKeyboard->setEventCallback(pKeyListener);
if(pMouseListener == 0)
m_pMouse->setEventCallback(this);
else
m_pKeyboard->setEventCallback(pKeyListener);
在DEBUG模式下所有变量都有正确的赋值 但是在RELEASE模式下 m_pKeyboard m_pMouse都是空指针 所以在最后的局域试图调用m_pKeyboard->setEventCallback(pKeyListener);的时候会报错 但是为什么会有这样的结果?
|
|