Skip to content

Commit

Permalink
Don't remove parameters in ShaderBuilder destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
dragly committed Oct 14, 2016
1 parent 9d374f9 commit 505f041
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/shaderbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@ ShaderBuilder::ShaderBuilder(QNode *parent)

ShaderBuilder::~ShaderBuilder()
{
clear();
disconnectDependencies();
}

void ShaderBuilder::clear()
void ShaderBuilder::disconnectDependencies()
{
emit clearBegin();

if(m_renderPass) {
for(ShaderUniformValue *uniform : m_uniforms) {
m_renderPass->removeParameter(uniform->m_parameter);
}
}

for(const auto& node : m_dependencies) {
disconnect(node, &ShaderNode::headerChanged, this, &ShaderBuilder::markDirty);
disconnect(node, &ShaderNode::resultChanged, this, &ShaderBuilder::markDirty);
Expand All @@ -44,6 +36,19 @@ void ShaderBuilder::clear()
disconnect(node, &ShaderNode::propertyTypeChanged, this, &ShaderBuilder::markDirty);
disconnect(node, &ShaderNode::markDirty, this, &ShaderBuilder::markDirty);
}
}

void ShaderBuilder::clear()
{
emit clearBegin();

if(m_renderPass) {
for(ShaderUniformValue *uniform : m_uniforms) {
m_renderPass->removeParameter(uniform->m_parameter);
}
}

disconnectDependencies();

m_dependencies.clear();

Expand Down
1 change: 1 addition & 0 deletions src/shaderbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public slots:

friend class ShaderBuilderMaterialBinding;
Qt3DRender::QRenderPass* renderPass() const;
void disconnectDependencies();
};

#endif // SHADERBUILDER_H

0 comments on commit 505f041

Please sign in to comment.