[SOLVED] QuickGUI runtime crash when mouse mouve

lpa

15-07-2010 13:21:19

Hi,
I have build QuickGUI 10.1 in debug version for Ogre 1.7.1 with vs c++ 2008 express.
When i lunch my exe all works fine but when i press a key or i mouve mouse that crash.

Exception non gérée à 0x00612cc6 (QuickGUI_d.dll) dans tower.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0xcccccd80.
(Unhandled exception at 0x00612cc6 (QuickGUI_d.dll) in tower.exe: 0xC0000005:
Access violation when reading the site 0xcccccd80.)


my code:

bool World::setup(void)
{
mRoot = new Ogre::Root(mPluginsCfg);

QuickGUI::registerScriptReader();

setupResources();

bool carryOn = configure();
if (!carryOn) return false;

chooseSceneManager();
camera = new Camera(mSceneMgr,mWindow);

// Set default mipmap level (NB some APIs ignore this)
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

// Create any resource listeners (for loading screens)
createResourceListener();
// Load resources
loadResources();

//initializ quick gui
new QuickGUI::Root();
QuickGUI::SkinTypeManager::getSingleton().loadTypes();
QuickGUI::GUIManagerDesc d;
d.sceneManager = mSceneMgr;
d.viewport = camera->getViewport();
d.queueID = Ogre::RENDER_QUEUE_OVERLAY;
d.name="tower_GUI";
QuickGUI::GUIManager* GUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(d);


/*QuickGUI::Sheet* GUISheet = QuickGUI::SheetManager::getSingleton().createSheet("media/default.sheet",true);
GUIManager->setActiveSheet(GUISheet);*/
QuickGUI::SheetDesc* sd = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();
sd->resetToDefault();
sd->widget_dimensions.size = QuickGUI::Size(800,600);
QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet(sd);
GUIManager->setActiveSheet(mySheet);


// Create the scene
createScene();
createFrameListener();


return true;
};

bool World::mouseMoved( const OIS::MouseEvent &arg )
{
float z = arg.state.Z.rel;
if(z != 0)
GUIManager->injectMouseWheelChange(z);

GUIManager->injectMousePosition(arg.state.X.abs, arg.state.Y.abs);

if (mTrayMgr->injectMouseMove(arg)) return true;

rotX = Ogre::Degree(-arg.state.X.rel * 0.13);
rotY = Ogre::Degree(-arg.state.Y.rel * 0.13);

camera->rotate(rotX,rotY);
return true;
}


edit: i try to bluid the release version and that not crash but the mouse cursor don't move (i don't know if it's normaly).
re edit: tank you i have solved my probleme by juste change this line:
QuickGUI::GUIManager* GUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(d);
to
GUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(d);
all work and the cusor move :)

Thanks and sorry for my bad english.

kungfoomasta

15-07-2010 18:17:11

I'm not sure what the differences are between those lines, but I'm glad you got it working. :)

Stardragon

30-08-2010 07:40:00

I suspect I do :-)

I think what was happening is that the GUIManager variable was being declared twice, once in the header file as you'd expect, and then again within the scope of the initialising function... so of course when that function closes, the locally-defined variable goes out of scope and the GUIManager ceases to be. :D

Calder

30-08-2010 14:05:12

Nah, that doesn't happen with pointers...

Stardragon

30-08-2010 16:49:21

*goes back into his corner with the edible glue*

kungfoomasta

30-08-2010 18:08:08

:lol:

Stardragon, you trying to resurrect threads or what?

QuickGUI for the most part always calls 'new' and 'delete' for objects, so scope is never the issue.

Calder

01-09-2010 05:31:20

Stardragon, may I hereafter refer to you as "Stardragon, Threadromancer of the High Court" or something similarly grand-sounding? :P

EDIT: This somehow escaped my notice on first reading:

When i lunch my exe all works fine but when i press a key or i mouve mouse that crash.

I too occasionally enjoy lunching on exe's. :D

Stardragon

01-09-2010 09:53:20

Stardragon, may I hereafter refer to you as "Stardragon, Threadromancer of the High Court" or something similarly grand-sounding? :P

EDIT: This somehow escaped my notice on first reading:

When i lunch my exe all works fine but when i press a key or i mouve mouse that crash.

I too occasionally enjoy lunching on exe's. :D

:lol:

And certainly, you may call me that... :D though since you're the one who wrote the code I suspect you should have a similar title :-) How about "Calder, Pontifex Muteximus Maximus"? :lol:

Calder

02-09-2010 03:23:51

Actually, I was referring to your newly discovered talent for thread-necromancy which KFM pointed out! :D But I guess the other works as well, Great Resuscitator. :P

Stardragon

02-09-2010 09:41:04

Actually, I was referring to your newly discovered talent for thread-necromancy which KFM pointed out! :D But I guess the other works as well, Great Resuscitator. :P
*narrows eyes* Watch it, you colonial upstart.

:wink: :lol: