[vala/wip/tintou/source-file-remove-code-context] vala: Ensure that the CodeContext has no reference to the node before removing it



commit 378a1d0bbed1919fe3c56006fc8a171ec59f7cf4
Author: Corentin Noël <corentin noel collabora com>
Date:   Fri Mar 15 15:17:03 2019 +0100

    vala: Ensure that the CodeContext has no reference to the node before removing it

 vala/valasourcefile.vala | 7 +++++++
 1 file changed, 7 insertions(+)
---
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);
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]