[latexila] Document: weak ref on the DocumentTab



commit 1daf96cb17bdd83e0cd83231097f17bedf46c367
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Mar 4 13:10:53 2017 +0100

    Document: weak ref on the DocumentTab
    
    If latexila opens just one DocumentTab, on application exit there were 3
    remaining refs to that DocumentTab. Now it's reduced to 2 remaining
    refs. So the memory leak is not fixed, but it's one step closer to fix
    it.
    
    Note that an object should not be aware of who contains it. It's fine
    for DocumentTab to know about Document, since Document is contained in
    DocumentTab, but the reverse is not a good practice. This code was
    written a long time ago…
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761181

 src/document.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/document.vala b/src/document.vala
index 3055264..4a888ab 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -23,7 +23,7 @@ public class Document : Gtef.Buffer
 {
     public File location { get; set; }
     public bool readonly { get; set; default = false; }
-    public DocumentTab tab;
+    public weak DocumentTab tab;
     public uint _unsaved_doc_num = 0;
     public int project_id { get; set; default = -1; }
     private bool backup_made = false;


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