Skip to content

Commit

Permalink
Fix crash after saving a particle that has been used in the map (#4411)
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 1, 2016
1 parent b9ea964 commit b5e689f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
3 changes: 3 additions & 0 deletions plugins/particles/ParticleDef.cpp
Expand Up @@ -59,6 +59,9 @@ void ParticleDef::copyFrom(const IParticleDef& other)
stage->signal_changed().connect(_changedSignal.make_slot());
_stages.push_back(stage);
}

// We've changed all the stages, so emit the changed signal now (#4411)
_changedSignal.emit();
}

void ParticleDef::parseFromTokens(parser::DefTokeniser& tok)
Expand Down
31 changes: 17 additions & 14 deletions plugins/particles/ParticleDef.h
Expand Up @@ -47,12 +47,12 @@ class ParticleDef
/**
* Return the ParticleDef name.
*/
const std::string& getName() const
const std::string& getName() const override
{
return _name;
}

const std::string& getFilename() const
const std::string& getFilename() const override
{
return _filename;
}
Expand All @@ -71,42 +71,45 @@ class ParticleDef
}

// IParticleDef implementation
sigc::signal<void> signal_changed() const { return _changedSignal; }
sigc::signal<void> signal_changed() const override
{
return _changedSignal;
}

float getDepthHack() const
float getDepthHack() const override
{
return _depthHack;
}

void setDepthHack(float value)
void setDepthHack(float value) override
{
_depthHack = value;
}

std::size_t getNumStages() const
std::size_t getNumStages() const override
{
return _stages.size();
}

const IStageDef& getStage(std::size_t stageNum) const
const IStageDef& getStage(std::size_t stageNum) const override
{
return *_stages[stageNum];
}

IStageDef& getStage(std::size_t stageNum)
IStageDef& getStage(std::size_t stageNum) override
{
return *_stages[stageNum];
}

std::size_t addParticleStage() ;
std::size_t addParticleStage() override;

void removeParticleStage(std::size_t index);
void removeParticleStage(std::size_t index) override;

void swapParticleStages(std::size_t index, std::size_t index2);
void swapParticleStages(std::size_t index, std::size_t index2) override;

void appendStage(const StageDefPtr& stage);

bool operator==(const IParticleDef& other) const
bool operator==(const IParticleDef& other) const override
{
// Compare depth hack flag
if (getDepthHack() != other.getDepthHack()) return false;
Expand All @@ -124,12 +127,12 @@ class ParticleDef
return true;
}

bool operator!=(const IParticleDef& other) const
bool operator!=(const IParticleDef& other) const override
{
return !operator==(other);
}

void copyFrom(const IParticleDef& other);
void copyFrom(const IParticleDef& other) override;

void parseFromTokens(parser::DefTokeniser& tok);

Expand Down

0 comments on commit b5e689f

Please sign in to comment.