hotfix for CharacterPreview destructor

This commit is contained in:
Marc Zinnschlag 2013-04-19 14:41:26 +02:00 committed by scrawl
parent 21bdcc9f20
commit 87ce2110dc

View file

@ -21,13 +21,15 @@ namespace MWRender
CharacterPreview::CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name, CharacterPreview::CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
Ogre::Vector3 position, Ogre::Vector3 lookAt) Ogre::Vector3 position, Ogre::Vector3 lookAt)
: mSizeX(sizeX)
, mSizeY(sizeY) : mSceneMgr (0)
, mName(name)
, mPosition(position) , mPosition(position)
, mLookAt(lookAt) , mLookAt(lookAt)
, mCharacter(character) , mCharacter(character)
, mAnimation(NULL) , mAnimation(NULL)
, mName(name)
, mSizeX(sizeX)
, mSizeY(sizeY)
{ {
} }
@ -88,16 +90,20 @@ namespace MWRender
CharacterPreview::~CharacterPreview () CharacterPreview::~CharacterPreview ()
{ {
//Ogre::TextureManager::getSingleton().remove(mName); if (mSceneMgr)
mSceneMgr->destroyCamera (mName); {
delete mAnimation; //Ogre::TextureManager::getSingleton().remove(mName);
Ogre::Root::getSingleton().destroySceneManager(mSceneMgr); mSceneMgr->destroyAllCameras();
delete mAnimation;
Ogre::Root::getSingleton().destroySceneManager(mSceneMgr);
}
} }
void CharacterPreview::rebuild() void CharacterPreview::rebuild()
{ {
assert(mAnimation); assert(mAnimation);
delete mAnimation; delete mAnimation;
mAnimation = 0;
mAnimation = new NpcAnimation(mCharacter, mNode, MWWorld::Class::get(mCharacter).getInventoryStore(mCharacter), mAnimation = new NpcAnimation(mCharacter, mNode, MWWorld::Class::get(mCharacter).getInventoryStore(mCharacter),
0, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal)); 0, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));