Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: OIS Segmentation fault. [Debug info provided]  (Read 487 times)

ht3k

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
OIS Segmentation fault. [Debug info provided]
« on: November 22, 2010, 07:43:16 PM »

I'm on Ubuntu Linux 10.10. WIth OGRE 1.7.2 and OIS 1.2 trying out the OGRE tutorial/examples and they compile fine. When I try to run OGRE after I choose the video settings, I get thrown the following error in the terminal:

Code: [Select]
Parsing scripts for resource group Internal
Finished parsing scripts for resource group Internal
*** Initializing OIS ***
Segmentation fault

I looked everywhere on Google, OIS Forums, OGRE forums but it said little to no details (for hours I might add). So I will write this thoroughly with better details as far as debugging.

This was difficult to debug, since I lost control of my keyboard and mouse after these lines:

BaseApplication.cpp:

 
Code: [Select]
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
    mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));

After I commented them out I was able to continue to see where the segment fault ocurred.

I got to this piece of code where the segment fault occurs:

BaseApplication.cpp:

Code: [Select]
void BaseApplication::windowResized(Ogre::RenderWindow* rw)
{
    unsigned int width, height, depth;
    int left, top;
    rw->getMetrics(width, height, depth, left, top);

    const OIS::MouseState &ms = mMouse->getMouseState();
    ms.width = width;
    ms.height = height;

}

When the breakpoint hits:

Code: [Select]
ms.width = width;
It is where I get the segment fault. The problem may be the line before it (I think) when it calls to OISMouse.h from class mMouse->getMouseState();

OISMouse.h:

class _OISExport Mouse : public Object
{...

/** @remarks Returns the state of the mouse - is valid for both buffered and non buffered mode */
      const MouseState& getMouseState() const { return mState; }

...}

When debugging, these are the variables and values of OISMouse.h

Name:         Value:

[mListener]  "Cannot access memory at address 0x54"   

[mState]      "Cannot access memory at address 0x18"   

------------------------------------

And when it hits ms.width = width; I get the following debugging information:

Name:         Value:

[mMouse]     0x0   
[ms]            (const OIS::MouseState &) @0x18: <error reading variable>   
[ms.width]   "Cannot access memory at address 0x18"   
[width]         800   

-----------------------------

Here's other debugging information (if it helps) of when I hit the line before "ms.width = width;"

http://img534.imageshack.us/img534/9020/debugging.png

Some more debugging information from variable "ms" from the picture above:

"(const OIS::MouseState &) @0xbffff518: {width = -1073744184, height = 134533926, X = {<OIS::Component> = {cType = 3221223236}, abs = -1217522048, rel = -1073744316, absOnly = false}, Y = {<OIS::Component> = {cType = 6856692}, abs = -1215421172, rel = 3698673, absOnly = 244}, Z = {<OIS::Component> = {cType = 3084862184}, abs = 6829016, rel = 7965004, absOnly = 72}, buttons = 138323333}"


If anyone could point me to what's wrong and how I could fix it I would greatly appreciate it. Thanks!
« Last Edit: November 22, 2010, 07:48:08 PM by ht3k »
Logged

ht3k

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Re: OIS Segmentation fault. [Debug info provided]
« Reply #1 on: November 23, 2010, 05:14:16 AM »

Well, nevermind. I have solved it over at :

http://www.ogre3d.org/forums/viewtopic.php?f=2&t=61614&p=410868#p410868

Maybe this will help other people that have posted this error before that are looking through google searches. Except, with an answer this time around. ;D
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS Segmentation fault. [Debug info provided]
« Reply #2 on: November 24, 2010, 07:22:00 AM »

Glad you found the issue. I know these types of crashes can be hard to figure out.
Logged