Fixed small memory leaks and uninitialized values
This commit is contained in:
parent
2b65f1d26a
commit
5e9b37d52c
7 changed files with 21 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
AtmosphereDefinition::AtmosphereDefinition(DefinitionNode *parent)
|
||||
: DefinitionNode(parent, "atmosphere", "atmosphere") {
|
||||
model = ATMOSPHERE_MODEL_DISABLED;
|
||||
godrays = new GodRaysDefinition(this);
|
||||
daytime = new FloatNode(this, "daytime");
|
||||
humidity = new FloatNode(this, "humidity");
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
OpenGLSharedState::OpenGLSharedState() {
|
||||
}
|
||||
|
||||
paysages::opengl::OpenGLSharedState::~OpenGLSharedState()
|
||||
{
|
||||
for (const auto &pair : variables) {
|
||||
delete pair.second;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLSharedState::apply(OpenGLShaderProgram *program, int &texture_unit) {
|
||||
for (const auto &pair : variables) {
|
||||
pair.second->apply(program, texture_unit);
|
||||
|
@ -11,7 +18,7 @@ void OpenGLSharedState::apply(OpenGLShaderProgram *program, int &texture_unit) {
|
|||
|
||||
OpenGLVariable *OpenGLSharedState::get(const std::string &name) {
|
||||
OpenGLVariable *&var = variables[name];
|
||||
if (var == 0) {
|
||||
if (var == NULL) {
|
||||
var = new OpenGLVariable(name);
|
||||
}
|
||||
return var;
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace opengl {
|
|||
class OPENGLSHARED_EXPORT OpenGLSharedState {
|
||||
public:
|
||||
OpenGLSharedState();
|
||||
~OpenGLSharedState();
|
||||
|
||||
/*!
|
||||
* \brief Apply the stored variables to the bound program.
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
Thread::Thread(ThreadFunction function) : data(0), result(0), function(function) {
|
||||
}
|
||||
|
||||
Thread::~Thread() {
|
||||
}
|
||||
|
||||
void Thread::start(void *data) {
|
||||
this->data = data;
|
||||
QThread::start();
|
||||
|
|
|
@ -24,6 +24,8 @@ class SYSTEMSHARED_EXPORT Thread : private QThread {
|
|||
*/
|
||||
Thread(ThreadFunction function = 0);
|
||||
|
||||
virtual ~Thread();
|
||||
|
||||
/**
|
||||
* Start the thread, with custom data.
|
||||
*/
|
||||
|
|
|
@ -60,6 +60,7 @@ TEST(GodRaysSampler, setQuality) {
|
|||
class GodRayLightSource : public LightSource {
|
||||
virtual bool getLightsAt(std::vector<LightComponent> &result, const Vector3 &location) const override {
|
||||
LightComponent light;
|
||||
light.direction = VECTOR_DOWN;
|
||||
light.altered = true;
|
||||
light.color = Color(fabs(location.x), fabs(location.y), fabs(location.z));
|
||||
result.push_back(light);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "PackStream.h"
|
||||
#include "DiffManager.h"
|
||||
#include "IntNode.h"
|
||||
#include "DefinitionDiff.h"
|
||||
|
||||
static DefinitionNode *_construc1(Layers *, const std::string &name) {
|
||||
return new DefinitionNode(NULL, name);
|
||||
|
@ -193,4 +194,8 @@ TEST(Layers, generateInitDiffs) {
|
|||
EXPECT_EQ("l1", layers1.getLayer(0)->getName());
|
||||
EXPECT_EQ("l2", layers1.getLayer(1)->getName());
|
||||
EXPECT_EQ("l3", layers1.getLayer(2)->getName());
|
||||
|
||||
for (auto diff : diffs) {
|
||||
delete diff;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue