From: Mikko Rasa Date: Thu, 25 Feb 2021 22:38:43 +0000 (+0200) Subject: Unlink declarations on destruction X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c6d59d1b35ee981c10ee8b9870338ffbaaa23e19;p=libs%2Fgl.git Unlink declarations on destruction Just in case --- diff --git a/source/glsl/syntax.cpp b/source/glsl/syntax.cpp index 6c766fd7..bda0dd1d 100644 --- a/source/glsl/syntax.cpp +++ b/source/glsl/syntax.cpp @@ -262,6 +262,12 @@ VariableDeclaration::VariableDeclaration(const VariableDeclaration &other): layout(other.layout) { } +VariableDeclaration::~VariableDeclaration() +{ + if(linked_declaration && linked_declaration->linked_declaration==this) + linked_declaration->linked_declaration = 0; +} + void VariableDeclaration::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -284,6 +290,12 @@ InterfaceBlock::InterfaceBlock(const InterfaceBlock &other): linked_block(0) { } +InterfaceBlock::~InterfaceBlock() +{ + if(linked_block && linked_block->linked_block==this) + linked_block->linked_block = 0; +} + void InterfaceBlock::visit(NodeVisitor &visitor) { visitor.visit(*this); diff --git a/source/glsl/syntax.h b/source/glsl/syntax.h index f7e778b8..7729611c 100644 --- a/source/glsl/syntax.h +++ b/source/glsl/syntax.h @@ -305,6 +305,7 @@ struct VariableDeclaration: Statement VariableDeclaration(); VariableDeclaration(const VariableDeclaration &); + ~VariableDeclaration(); virtual VariableDeclaration *clone() const { return new VariableDeclaration(*this); } virtual void visit(NodeVisitor &); @@ -321,6 +322,7 @@ struct InterfaceBlock: Statement InterfaceBlock(); InterfaceBlock(const InterfaceBlock &); + ~InterfaceBlock(); virtual InterfaceBlock *clone() const { return new InterfaceBlock(*this); } virtual void visit(NodeVisitor &);