From: Corentin Noël Date: Fri, 15 Mar 2019 14:17:03 +0000 (+0100) Subject: vala: Ensure that the CodeContext has no reference to the node before removing it X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fwip%2Ftintou%2Fsource-file-remove-code-context;p=thirdparty%2Fvala.git vala: Ensure that the CodeContext has no reference to the node before removing it --- diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala index 35eaf5f26..acaea0d7c 100644 --- a/vala/valasourcefile.vala +++ b/vala/valasourcefile.vala @@ -197,6 +197,13 @@ public class Vala.SourceFile { } public void remove_node (CodeNode node) { + // Also update the entry point of the current code context + var code_context = CodeContext.get (); + unowned Vala.Method? entry_point = code_context.entry_point; + if (entry_point != null && entry_point.source_reference == node.source_reference) { + code_context.entry_point = null; + } + nodes.remove (node); }