From e27c58e95325eb89f7598051fbc21ea035418a95 Mon Sep 17 00:00:00 2001 From: Alexandros Naskos Date: Sun, 14 Jun 2020 21:11:49 +0300 Subject: [PATCH] Build file reference counting fix --- src/document_store.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/document_store.zig b/src/document_store.zig index 932be21..37ba83a 100644 --- a/src/document_store.zig +++ b/src/document_store.zig @@ -307,6 +307,8 @@ pub fn openDocument(self: *DocumentStore, uri: []const u8, text: []const u8) !*H } fn decrementBuildFileRefs(self: *DocumentStore, build_file: *BuildFile) void { + if (build_file.refs == 0) return; + build_file.refs -= 1; if (build_file.refs == 0) { std.debug.warn("Freeing build file {}\n", .{build_file.uri});