Merge branch 'fix_memory_leak' into 'master'

Fix memory leak on cell loading

See merge request OpenMW/openmw!2318
crashfix_debugdraw
psi29a 2 years ago
commit 857dca058b

@ -7,6 +7,7 @@
#include <components/esm3/inventorystate.hpp>
#include <components/misc/strings/algorithm.hpp>
#include <components/misc/strings/lower.hpp>
#include <components/sceneutil/positionattitudetransform.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"

@ -1,6 +1,7 @@
#include "refdata.hpp"
#include <components/esm3/objectstate.hpp>
#include <components/sceneutil/positionattitudetransform.hpp>
#include "customdata.hpp"
#include "cellstore.hpp"
@ -140,12 +141,12 @@ namespace MWWorld
{}
}
RefData::RefData(RefData&& other) noexcept = default;
RefData& RefData::operator=(RefData&& other) noexcept = default;
RefData::RefData(RefData&& other) = default;
RefData& RefData::operator=(RefData&& other) = default;
void RefData::setBaseNode(SceneUtil::PositionAttitudeTransform *base)
void RefData::setBaseNode(osg::ref_ptr<SceneUtil::PositionAttitudeTransform> base)
{
mBaseNode = base;
mBaseNode = std::move(base);
}
SceneUtil::PositionAttitudeTransform* RefData::getBaseNode()

@ -7,6 +7,8 @@
#include "../mwscript/locals.hpp"
#include "../mwworld/customdata.hpp"
#include <osg/ref_ptr>
#include <string>
#include <memory>
@ -34,7 +36,7 @@ namespace MWWorld
class RefData
{
SceneUtil::PositionAttitudeTransform* mBaseNode;
osg::ref_ptr<SceneUtil::PositionAttitudeTransform> mBaseNode;
MWScript::Locals mLocals;
std::shared_ptr<MWLua::LocalScripts> mLuaScripts;
@ -78,7 +80,7 @@ namespace MWWorld
/// perform these operations).
RefData (const RefData& refData);
RefData (RefData&& other) noexcept;
RefData (RefData&& other);
~RefData();
@ -87,7 +89,7 @@ namespace MWWorld
/// perform this operations).
RefData& operator= (const RefData& refData);
RefData& operator= (RefData&& other) noexcept;
RefData& operator= (RefData&& other);
/// Return base node (can be a null pointer).
SceneUtil::PositionAttitudeTransform* getBaseNode();
@ -96,7 +98,7 @@ namespace MWWorld
const SceneUtil::PositionAttitudeTransform* getBaseNode() const;
/// Set base node (can be a null pointer).
void setBaseNode (SceneUtil::PositionAttitudeTransform* base);
void setBaseNode(osg::ref_ptr<SceneUtil::PositionAttitudeTransform> base);
int getCount(bool absolute = true) const;

Loading…
Cancel
Save