Fix use of UnrefQueue in removeObject

coverity_scan^2
scrawl 8 years ago
parent 3019d70986
commit 6615330430

@ -112,12 +112,12 @@ bool Objects::removeObject (const MWWorld::Ptr& ptr)
PtrAnimationMap::iterator iter = mObjects.find(ptr); PtrAnimationMap::iterator iter = mObjects.find(ptr);
if(iter != mObjects.end()) if(iter != mObjects.end())
{ {
if (mUnrefQueue.get())
mUnrefQueue->push(iter->second->getObjectRoot());
delete iter->second; delete iter->second;
mObjects.erase(iter); mObjects.erase(iter);
if (mUnrefQueue.get())
mUnrefQueue->push(ptr.getRefData().getBaseNode());
ptr.getRefData().getBaseNode()->getParent(0)->removeChild(ptr.getRefData().getBaseNode()); ptr.getRefData().getBaseNode()->getParent(0)->removeChild(ptr.getRefData().getBaseNode());
ptr.getRefData().setBaseNode(NULL); ptr.getRefData().setBaseNode(NULL);

Loading…
Cancel
Save