]> git.tdb.fi Git - libs/gl.git/commitdiff
Unlink declarations on destruction
authorMikko Rasa <tdb@tdb.fi>
Thu, 25 Feb 2021 22:38:43 +0000 (00:38 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 25 Feb 2021 23:21:10 +0000 (01:21 +0200)
Just in case

source/glsl/syntax.cpp
source/glsl/syntax.h

index 6c766fd758161283006de48f0cdbc09666e8d305..bda0dd1d7b2a0d673bcea91fc1fdbab23307ce37 100644 (file)
@@ -262,6 +262,12 @@ VariableDeclaration::VariableDeclaration(const VariableDeclaration &other):
        layout(other.layout)
 { }
 
        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);
 void VariableDeclaration::visit(NodeVisitor &visitor)
 {
        visitor.visit(*this);
@@ -284,6 +290,12 @@ InterfaceBlock::InterfaceBlock(const InterfaceBlock &other):
        linked_block(0)
 { }
 
        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);
 void InterfaceBlock::visit(NodeVisitor &visitor)
 {
        visitor.visit(*this);
index f7e778b89ef65d417afd1f44751930311c5e94ed..7729611c2a5e2a3d013b2e8a5112391af52ae668 100644 (file)
@@ -305,6 +305,7 @@ struct VariableDeclaration: Statement
 
        VariableDeclaration();
        VariableDeclaration(const VariableDeclaration &);
 
        VariableDeclaration();
        VariableDeclaration(const VariableDeclaration &);
+       ~VariableDeclaration();
 
        virtual VariableDeclaration *clone() const { return new VariableDeclaration(*this); }
        virtual void visit(NodeVisitor &);
 
        virtual VariableDeclaration *clone() const { return new VariableDeclaration(*this); }
        virtual void visit(NodeVisitor &);
@@ -321,6 +322,7 @@ struct InterfaceBlock: Statement
 
        InterfaceBlock();
        InterfaceBlock(const InterfaceBlock &);
 
        InterfaceBlock();
        InterfaceBlock(const InterfaceBlock &);
+       ~InterfaceBlock();
 
        virtual InterfaceBlock *clone() const { return new InterfaceBlock(*this); }
        virtual void visit(NodeVisitor &);
 
        virtual InterfaceBlock *clone() const { return new InterfaceBlock(*this); }
        virtual void visit(NodeVisitor &);