Making better use of Ogre's capbilities?

Everything about development and the OpenMW source code.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

scrawl wrote:Could it be possible that you load the same resource name with both loaders, and it gets double-freed on exit? Just guessing.
Just tried loading with different names for each loader, still same problem.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Still trying to figure out this crash problem.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Making better use of Ogre's capbilities?

Post by scrawl »

First, here is the gdb crashlog for everyone, just for the sake of completeness

Code: Select all

3	Ogre::Skeleton::~Skeleton()	/usr/lib/libOgreMain.so.1.8.0	0	0x7ffff7a3db29	
4	Ogre::SharedPtr<Ogre::Skeleton>::destroy	OgreSharedPtr.h	232	0x84b1aa	
5	Ogre::SharedPtr<Ogre::Skeleton>::release	OgreSharedPtr.h	218	0x847a1e	
6	Ogre::SharedPtr<Ogre::Skeleton>::~SharedPtr	OgreSharedPtr.h	155	0x84792f	
7	Ogre::SkeletonPtr::~SkeletonPtr	OgreSkeleton.h	470	0x85b7c5	
8	NifOgre::NIFLoader::~NIFLoader	ogre_nif_loader.hpp	121	0x85b574	
9	__run_exit_handlers	/lib/libc.so.6	0	0x7ffff46b67c1	
10	exit	/lib/libc.so.6	0	0x7ffff46b6845	
11	__libc_start_main	/lib/libc.so.6	0	0x7ffff46a045c	
12	_start		0	0x7dc2b5	
So, the problem is apparently caused by the destructor of member NIFLoader::mSkel;

I've tried a few things without success yet, will keep trying.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Making better use of Ogre's capbilities?

Post by scrawl »

I might have an idea.

The NIFLoader destructor is called by _run_exit_handlers (I'm guessing this deletes all static objects). And this is run _after_ the OGRE shutdown procedure. Judging from the Ogre.log produced by the crash, Ogre has already been shutdown completely:

Code: Select all

22:46:18: *-*-* OGRE Shutdown
22:46:18: Unregistering ResourceManager for type Compositor
22:46:18: Unregistering ResourceManager for type Font
22:46:18: Unregistering ResourceManager for type Skeleton
22:46:18: Unregistering ResourceManager for type Mesh
22:46:18: Unregistering ResourceManager for type HighLevelGpuProgram
22:46:18: Uninstalling plugin: Cg Program Manager
22:46:18: Plugin successfully uninstalled
22:46:18: Unloading library /usr/lib/OGRE/Plugin_CgProgramManager
22:46:18: Uninstalling plugin: Octree Scene Manager
22:46:18: Plugin successfully uninstalled
22:46:18: Unloading library /usr/lib/OGRE/Plugin_OctreeSceneManager
22:46:18: Uninstalling plugin: ParticleFX
22:46:18: Plugin successfully uninstalled
22:46:18: Unloading library /usr/lib/OGRE/Plugin_ParticleFX
22:46:18: Uninstalling plugin: GL RenderSystem
22:46:18: Unregistering ResourceManager for type GpuProgram
22:46:18: ******************************
*** Stopping GLX Subsystem ***
******************************
22:46:18: Unregistering ResourceManager for type Texture
22:46:18: Plugin successfully uninstalled
22:46:18: Unloading library /usr/lib/OGRE/RenderSystem_GL
22:46:18: Unregistering ResourceManager for type Material

It's not surprising that trying to delete a SkeletonPtr after
22:46:18: Unregistering ResourceManager for type Skeleton
has already happened causes a crash.

So I would say: Either store the SkeletonPtr only temporarily (set it to Null after a NIF was loaded), or destroy the NIF loader before ogre shuts down.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Thanks :) , will try it out in a sec. I need to definitely learn how to use gdb, I am poking around with everything trying to solve the problem.
Last edited by jhooks1 on 22 Jun 2012, 21:54, edited 1 time in total.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Making better use of Ogre's capbilities?

Post by scrawl »

putting mSkel.setNull(); at the bottom of NIFLoader::loadResource works, no crash :idea:
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Thanks dude :P
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Making better use of Ogre's capbilities?

Post by scrawl »

gdb in a nutshell

Code: Select all

gdb ./openmw
run --debug
(wait until crash)
bt
Edit: weren't you on win?
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

I'm on windows yes
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Making better use of Ogre's capbilities?

Post by scrawl »

Well then you should probably use the VS Debugger, gdb would be for MinGW
Post Reply