[vala/0.54] vala: Free empty stack list for code contexts
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.54] vala: Free empty stack list for code contexts
- Date: Wed, 9 Feb 2022 20:56:47 +0000 (UTC)
commit 2f67004de39fe6028c461bb953651b20c7f9a418
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Feb 9 17:36:14 2022 +0100
vala: Free empty stack list for code contexts
While having the stack list created on demand, make sure to destroy it
when it is not required anymore. Otherwise it will be leaked without an
option to avoid that to happen.
vala/valacodecontext.vala | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index 9fc211f7a..f96f87911 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -286,6 +286,11 @@ public class Vala.CodeContext {
}
context_stack->remove_at (context_stack->size - 1);
+
+ if (context_stack->size == 0) {
+ delete context_stack;
+ context_stack_key.set (null, null);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]