[UNSOLVED] Possible bug in Root destruction

Problems building or running the engine, queries about how to use features etc.
Post Reply
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

[UNSOLVED] Possible bug in Root destruction

Post by Navarre.it »

I'm having a crash happening for no apparent reason:

1. Open Demo_Gui sample;
2. Paste these lines at the end of GuiApplication::createScene():

Code: Select all

		Ogre::SceneManager *pSceneMgr = mSceneMgr;
		Ogre::Entity *pkEntity = pSceneMgr->createEntity( "Test278y3b23gh", "ninja.mesh" );
		Ogre::SceneNode *pkNode = pSceneMgr->getRootSceneNode()->createChildSceneNode( "TestNode" );
		pkNode->attachObject( pkEntity );
		Ogre::AnimationState *pkState = pkEntity->getAnimationState("Walk");
		pkState->setEnabled(true);
3. Compile & execute;
4. Quit & Crash.

Why is this :?:

@Administrator: I think my former account (Navarre) is considered inactive: can you reactivate it?
Last edited by Navarre.it on Mon Feb 14, 2005 8:42 pm, edited 2 times in total.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

Where exactly (use the debugger) does it crash?

My money's on pkEntity not having a "Walk" animation state, so pkState is null when you try to call setEnabled(true) on it.
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

Hi Monster,
I'm now recompiling the whole lib with STLport to make sure nothing strange is happening. Thanks for the prompt reply, too.
However, I had crashes during the destruction of Root, in particular the destruction of Vertex Buffers. Moreover, the mesh has a Walk state (it's the ninja or robot); and I had crashes even without the animstate code (just entity attachment seems to cause this.
However I invite you to follow the steps I detailed above to see if you have this crash too: can it possibly be a bug?
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

can it possibly be a bug?
Possibly. However I invite you to use your debugger and obtain us a precise location of the crash and a call stack at that point, together with the values of any relevant variables.
;)
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

Yes I forgot to say that upon rebuilding completion I would have posted those informations, sorry :oops:
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

I have deleted the whole ogrenew folder, rebuilt stlport anew, rebuilt ogre anew; all the samples run correctly except demo_gui which say that it can't find the right entry point in OgreMain_d.dll (all other samples does). Does CEGUI has something to set up when STLport is included?

#Edit: Forgot to mention that I'm using OgreRC1.
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

I reverted to OgreRC1 built without STLport, with VC7.1.
The crashOnExit issue continues showing up.

Here follows a detailed description:

To cause the error, open the Gui sample in Samples directory and paste these lines at the end of GuiApplication::createScene():

Code: Select all

		Ogre::SceneManager *pSceneMgr = mSceneMgr;
		Ogre::Entity *pkEntity = pSceneMgr->createEntity("TestEntity", "robot.mesh");
		Ogre::SceneNode *pkNode = pSceneMgr->getRootSceneNode()->createChildSceneNode("TestNode");
		pkNode->attachObject(pkEntity);

Run & close the application, I have a crash:

Code: Select all

Eccezione non gestita a 0x10419beb (OgreMain_d.dll) in Demo_Gui.exe: 0xC0000005: Violazione di accesso nella lettura del percorso 0x00000004.
which in english sounds like:

Code: Select all

Unmanaged exception a 0x10419beb (OgreMain_d.dll) in Demo_Gui.exe: 0xC0000005: Access violation in reading path 0x00000004.
Call stack is:

Code: Select all

>	OgreMain_d.dll!std::_Tree<std::_Tset_traits<Ogre::HardwareVertexBuffer *,std::less<Ogre::HardwareVertexBuffer *>,std::allocator<Ogre::HardwareVertexBuffer *>,0> >::_Lbound(Ogre::HardwareVertexBuffer * const & _Keyval=0x0364a178)  Riga 988 + 0x8	C++
 	OgreMain_d.dll!std::_Tree<std::_Tset_traits<Ogre::HardwareVertexBuffer *,std::less<Ogre::HardwareVertexBuffer *>,std::allocator<Ogre::HardwareVertexBuffer *>,0> >::lower_bound(Ogre::HardwareVertexBuffer * const & _Keyval=0x0364a178)  Riga 810 + 0xc	C++
 	OgreMain_d.dll!std::_Tree<std::_Tset_traits<Ogre::HardwareVertexBuffer *,std::less<Ogre::HardwareVertexBuffer *>,std::allocator<Ogre::HardwareVertexBuffer *>,0> >::find(Ogre::HardwareVertexBuffer * const & _Keyval=0x0364a178)  Riga 790	C++
 	OgreMain_d.dll!Ogre::HardwareBufferManager::_notifyVertexBufferDestroyed(Ogre::HardwareVertexBuffer * buf=0x0364a178)  Riga 279	C++
 	OgreMain_d.dll!Ogre::HardwareVertexBuffer::~HardwareVertexBuffer()  Riga 62	C++
 	RenderSystem_Direct3D9.dll!Ogre::D3D9HardwareVertexBuffer::~D3D9HardwareVertexBuffer()  Riga 66 + 0x12	C++
 	RenderSystem_Direct3D9.dll!Ogre::D3D9HardwareVertexBuffer::`scalar deleting destructor'()  + 0x2b	C++
 	OgreMain_d.dll!Ogre::SharedPtr<Ogre::HardwareVertexBuffer>::destroy()  Riga 149 + 0x6b	C++
 	OgreMain_d.dll!Ogre::SharedPtr<Ogre::HardwareVertexBuffer>::release()  Riga 140 + 0xd	C++
 	OgreMain_d.dll!Ogre::SharedPtr<Ogre::HardwareVertexBuffer>::~SharedPtr<Ogre::HardwareVertexBuffer>()  Riga 89	C++
 	OgreMain_d.dll!Ogre::HardwareVertexBufferSharedPtr::~HardwareVertexBufferSharedPtr()  + 0x2b	C++
 	OgreMain_d.dll!Ogre::HardwareBufferManager::VertexBufferLicense::~VertexBufferLicense()  + 0x2e	C++
 	OgreMain_d.dll!Ogre::HardwareBufferManager::VertexBufferLicense::`scalar deleting destructor'()  + 0x2b	C++
 	OgreMain_d.dll!std::_Destroy<Ogre::HardwareBufferManager::VertexBufferLicense>(Ogre::HardwareBufferManager::VertexBufferLicense * _Ptr=0x0360f6e0)  Riga 50	C++
 	OgreMain_d.dll!std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense>::destroy(Ogre::HardwareBufferManager::VertexBufferLicense * _Ptr=0x0360f6e0)  Riga 152 + 0x9	C++
 	OgreMain_d.dll!std::_Destroy_range<Ogre::HardwareBufferManager::VertexBufferLicense,std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> >(Ogre::HardwareBufferManager::VertexBufferLicense * _First=0x0360f6e0, Ogre::HardwareBufferManager::VertexBufferLicense * _Last=0x0360f6f8, std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> & _Al={...}, std::_Nonscalar_ptr_iterator_tag __formal={...})  Riga 226 + 0xc	C++
 	OgreMain_d.dll!std::_Destroy_range<Ogre::HardwareBufferManager::VertexBufferLicense,std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> >(Ogre::HardwareBufferManager::VertexBufferLicense * _First=0x0360f6e0, Ogre::HardwareBufferManager::VertexBufferLicense * _Last=0x0360f6f8, std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> & _Al={...})  Riga 217 + 0x2e	C++
 	OgreMain_d.dll!std::vector<Ogre::HardwareBufferManager::VertexBufferLicense,std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> >::_Destroy(Ogre::HardwareBufferManager::VertexBufferLicense * _First=0x0360f6e0, Ogre::HardwareBufferManager::VertexBufferLicense * _Last=0x0360f6f8)  Riga 787 + 0x11	C++
 	OgreMain_d.dll!std::vector<Ogre::HardwareBufferManager::VertexBufferLicense,std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> >::_Tidy()  Riga 795	C++
 	OgreMain_d.dll!std::vector<Ogre::HardwareBufferManager::VertexBufferLicense,std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> >::~vector<Ogre::HardwareBufferManager::VertexBufferLicense,std::allocator<Ogre::HardwareBufferManager::VertexBufferLicense> >()  Riga 389	C++
 	OgreMain_d.dll!Ogre::HardwareBufferManager::~HardwareBufferManager()  Riga 61 + 0x2d	C++
 	RenderSystem_Direct3D9.dll!Ogre::D3D9HardwareBufferManager::~D3D9HardwareBufferManager()  Riga 41 + 0x12	C++
 	RenderSystem_Direct3D9.dll!Ogre::D3D9HardwareBufferManager::`scalar deleting destructor'()  + 0x2b	C++
 	RenderSystem_Direct3D9.dll!Ogre::D3D9RenderSystem::~D3D9RenderSystem()  Riga 128 + 0x98	C++
 	RenderSystem_Direct3D9.dll!Ogre::D3D9RenderSystem::`scalar deleting destructor'()  + 0x2b	C++
 	RenderSystem_Direct3D9.dll!dllStopPlugin()  Riga 50 + 0x84	C++
 	OgreMain_d.dll!Ogre::Root::unloadPlugins()  Riga 693 + 0x5	C++
 	OgreMain_d.dll!Ogre::Root::~Root()  Riga 264	C++
 	Demo_Gui.exe!Ogre::Root::`scalar deleting destructor'()  + 0x2e	C++
 	Demo_Gui.exe!ExampleApplication::~ExampleApplication()  Riga 49 + 0x76	C++
 	Demo_Gui.exe!GuiApplication::~GuiApplication()  Riga 197 + 0x1e	C++
 	Demo_Gui.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00141f1d, HINSTANCE__ * __formal=0x00000000)  Riga 588 + 0x19	C++
 	Demo_Gui.exe!WinMainCRTStartup()  Riga 390 + 0x39	C
 	kernel32.dll!7c816d4f() 	
 	ntdll.dll!7c925b4f() 	
 	kernel32.dll!7c8399f3() 	

I can reproduce this bug at will, so please ask for further informations if you need them! Isn't it very strange?
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

I still couldn't figure out what's wrong in these 4 lines of code. If they're correct, this can be a really serious issue! Anyone?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Those 4 lines work perfectly for me, sorry. No-one else is reporting any issues at this stage.
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

I tried my binary on another PC (different HW) and it still crashes on exit, so it can't even be some driver issue. These 4 lines work for Sinbad (and for anyone else I suppose) so it *must* be something with my libs/windows installation/overall setup. :?

I'll keep you posted...
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 151
Contact:

Post by spookyboo »

Which stlport version do you use? I was using 4.5.3 but this doesn't work with the GUI demo (it only complained about the .dll though, I didn't have the problems you are describing). Maybe you should build Ogre with the 4.6.2 version.
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

GUI demo works fine for me!
phear hingo

My Webpage
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

I tried to compile OGRE with STLPort 4.6.2 and everything BUT the GUIDemo compiled fine.
Now I'm without STLPort (GUIDemo compiles), and the above results refer to this case. Even if compiling, it crashes on exit. By now I can't reinstall my whole system, so I'll have to wait to solve this issue! Thanks anyway :!:
_lkoikm
Halfling
Posts: 57
Joined: Fri Feb 11, 2005 7:52 am
Location: Here.

Post by _lkoikm »

it crashes all the times?
if it is so try to disable some lines of code to trace if some sub part causes the problem ... that would be handy.
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

Poorly, it crashes all the times; moreover, the crash does not happen on those lines but just when I shutdown the application. Specifically, it's the entity attachment the reason of these crashes (if I don't attach the entity to the node, no crash happens on exit).
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Argh, I'm a fool. The reason the people here aren't seeing this is because this was a bug I fixed very soon after RC1 - I don't think it manifested itself quite like this, but I'm pretty sure it's the same thing. If you update to the latest CVS version you probably won't have the problem anymore.
Navarre.it
Gnoblar
Posts: 10
Joined: Mon Feb 14, 2005 1:49 pm
Contact:

Post by Navarre.it »

I'll let you know as soon as I can get my hands on it. Thank your very much for the support! :o
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Make sure you update to the 'v1-0' branch which contains all the bugfixes, I haven't merged to HEAD yet.
Post Reply