From c6d59d1b35ee981c10ee8b9870338ffbaaa23e19 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 26 Feb 2021 00:38:43 +0200 Subject: [PATCH] Unlink declarations on destruction Just in case --- source/glsl/syntax.cpp | 12 ++++++++++++ source/glsl/syntax.h | 2 ++ 2 files changed, 14 insertions(+) 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 &); -- 2.43.0