forked from teamnwah/openmw-tes3coop
Do not detach NPC parts in destructor
This commit is contained in:
parent
40a6e05e17
commit
ae031b23d4
3 changed files with 16 additions and 1 deletions
|
@ -1409,8 +1409,13 @@ namespace MWRender
|
||||||
|
|
||||||
PartHolder::~PartHolder()
|
PartHolder::~PartHolder()
|
||||||
{
|
{
|
||||||
if (mNode->getNumParents())
|
if (mNode.get() && mNode->getNumParents())
|
||||||
mNode->getParent(0)->removeChild(mNode);
|
mNode->getParent(0)->removeChild(mNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PartHolder::unlink()
|
||||||
|
{
|
||||||
|
mNode = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,9 @@ public:
|
||||||
|
|
||||||
~PartHolder();
|
~PartHolder();
|
||||||
|
|
||||||
|
/// Unreferences mNode *without* detaching it from the graph. Only use if you know what you are doing.
|
||||||
|
void unlink();
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> getNode()
|
osg::ref_ptr<osg::Node> getNode()
|
||||||
{
|
{
|
||||||
return mNode;
|
return mNode;
|
||||||
|
|
|
@ -273,6 +273,13 @@ NpcAnimation::~NpcAnimation()
|
||||||
// all from within this destructor. ouch!
|
// all from within this destructor. ouch!
|
||||||
&& mPtr.getRefData().getCustomData() && mPtr.getClass().getInventoryStore(mPtr).getListener() == this)
|
&& mPtr.getRefData().getCustomData() && mPtr.getClass().getInventoryStore(mPtr).getListener() == this)
|
||||||
mPtr.getClass().getInventoryStore(mPtr).setListener(NULL, mPtr);
|
mPtr.getClass().getInventoryStore(mPtr).setListener(NULL, mPtr);
|
||||||
|
|
||||||
|
// do not detach (delete) parts yet, this is done so the background thread can handle the deletion
|
||||||
|
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
||||||
|
{
|
||||||
|
if (mObjectParts[i].get())
|
||||||
|
mObjectParts[i]->unlink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem,
|
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem,
|
||||||
|
|
Loading…
Reference in a new issue