[gedit-code-assistance] Remove circular reference in semantic value
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-code-assistance] Remove circular reference in semantic value
- Date: Fri, 2 Mar 2012 23:33:47 +0000 (UTC)
commit 7f5ad36d0b715c6b29f30a5ff841100f91d92d53
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Sat Mar 3 00:33:20 2012 +0100
Remove circular reference in semantic value
This solves a big memory leak
src/gcp-c-semantic-value.vala | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/gcp-c-semantic-value.vala b/src/gcp-c-semantic-value.vala
index 29c3387..8ce8895 100644
--- a/src/gcp-c-semantic-value.vala
+++ b/src/gcp-c-semantic-value.vala
@@ -73,7 +73,7 @@ class SemanticValue : Gcp.SemanticValue
private unowned Gcp.SemanticValue? d_previous;
private unowned Gcp.SemanticValue? d_up;
private Gcp.SemanticValue? d_down;
- private ArrayList<unowned SemanticValue> d_references;
+ private ArrayList<SemanticValue *> d_references;
public SemanticValue(CX.Cursor cursor)
{
@@ -81,10 +81,20 @@ class SemanticValue : Gcp.SemanticValue
Gcp.C.Translator.semantic_kind(cursor),
Gcp.C.Translator.semantic_reference_type(cursor));
- d_references = new ArrayList<SemanticValue>();
+ d_references = new ArrayList<SemanticValue *>();
d_cursor = cursor;
}
+ construct
+ {
+ stdout.printf("Created sem val: %p\n", this);
+ }
+
+ ~SemanticValue()
+ {
+ stdout.printf("Destroyed sem val: %p\n", this);
+ }
+
public CX.Cursor get_cursor()
{
return d_cursor;
@@ -183,6 +193,7 @@ class SemanticValue : Gcp.SemanticValue
{
Translator tr = new Translator(mapped, source);
SemanticValue ret = new SemanticValue(cursor);
+
tr.translate(ret);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]