mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 14:59:14 +02:00
Merge pull request #13357 from SimonWalton-HiFi/memcheck-fixes
Entity Script Server memory leak when taking down EntityTree
This commit is contained in:
commit
f2a3907e3d
5 changed files with 12 additions and 9 deletions
|
@ -17,6 +17,9 @@ EntityTreeHeadlessViewer::EntityTreeHeadlessViewer()
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityTreeHeadlessViewer::~EntityTreeHeadlessViewer() {
|
EntityTreeHeadlessViewer::~EntityTreeHeadlessViewer() {
|
||||||
|
if (_simulation) {
|
||||||
|
_simulation->setEntityTree(nullptr); // Break shared_ptr cycle.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeHeadlessViewer::init() {
|
void EntityTreeHeadlessViewer::init() {
|
||||||
|
|
|
@ -571,6 +571,8 @@ void EntityScriptServer::aboutToFinish() {
|
||||||
entityScriptingInterface->setPacketSender(nullptr);
|
entityScriptingInterface->setPacketSender(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DependencyManager::destroy<AssignmentParentFinder>();
|
||||||
|
|
||||||
DependencyManager::get<ResourceManager>()->cleanup();
|
DependencyManager::get<ResourceManager>()->cleanup();
|
||||||
|
|
||||||
DependencyManager::destroy<PluginManager>();
|
DependencyManager::destroy<PluginManager>();
|
||||||
|
|
|
@ -199,7 +199,9 @@ void NLPacket::readVersion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NLPacket::readSourceID() {
|
void NLPacket::readSourceID() {
|
||||||
if (!PacketTypeEnum::getNonSourcedPackets().contains(_type)) {
|
if (PacketTypeEnum::getNonSourcedPackets().contains(_type)) {
|
||||||
|
_sourceID = NULL_LOCAL_ID;
|
||||||
|
} else {
|
||||||
_sourceID = sourceIDInHeader(*this);
|
_sourceID = sourceIDInHeader(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,6 @@
|
||||||
|
|
||||||
#include "OctreeLogging.h"
|
#include "OctreeLogging.h"
|
||||||
|
|
||||||
OctreeProcessor::OctreeProcessor() :
|
|
||||||
_tree(NULL),
|
|
||||||
_managedTree(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void OctreeProcessor::init() {
|
void OctreeProcessor::init() {
|
||||||
if (!_tree) {
|
if (!_tree) {
|
||||||
_tree = createTree();
|
_tree = createTree();
|
||||||
|
@ -34,6 +28,9 @@ void OctreeProcessor::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
OctreeProcessor::~OctreeProcessor() {
|
OctreeProcessor::~OctreeProcessor() {
|
||||||
|
if (_tree) {
|
||||||
|
_tree->eraseAllOctreeElements(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeProcessor::setTree(OctreePointer newTree) {
|
void OctreeProcessor::setTree(OctreePointer newTree) {
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
class OctreeProcessor : public QObject, public QEnableSharedFromThis<OctreeProcessor> {
|
class OctreeProcessor : public QObject, public QEnableSharedFromThis<OctreeProcessor> {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
OctreeProcessor();
|
|
||||||
virtual ~OctreeProcessor();
|
virtual ~OctreeProcessor();
|
||||||
|
|
||||||
virtual char getMyNodeType() const = 0;
|
virtual char getMyNodeType() const = 0;
|
||||||
|
@ -61,7 +60,7 @@ protected:
|
||||||
virtual OctreePointer createTree() = 0;
|
virtual OctreePointer createTree() = 0;
|
||||||
|
|
||||||
OctreePointer _tree;
|
OctreePointer _tree;
|
||||||
bool _managedTree;
|
bool _managedTree { false };
|
||||||
|
|
||||||
SimpleMovingAverage _elementsPerPacket;
|
SimpleMovingAverage _elementsPerPacket;
|
||||||
SimpleMovingAverage _entitiesPerPacket;
|
SimpleMovingAverage _entitiesPerPacket;
|
||||||
|
|
Loading…
Reference in a new issue