localrepo: prevent leak of transaction object (issue4258) stable
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 21 May 2014 18:02:35 -0700
branchstable
changeset 21698 99ba1d082287
parent 21615 3cb2da25b171
child 21699 269c80ee5b3c
localrepo: prevent leak of transaction object (issue4258) The onclose() closure added in cd443c7589cc held a regular reference to the transaction object. This was causing the transaction to not gc and a leak to occur. The closure now holds a reference to the weakref instance and the leak goes away.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu May 22 01:49:12 2014 -0700
+++ b/mercurial/localrepo.py	Wed May 21 18:02:35 2014 -0700
@@ -858,7 +858,7 @@
                 _("abandoned transaction found - run hg recover"))
 
         def onclose():
-            self.store.write(tr)
+            self.store.write(self._transref())
 
         self._writejournal(desc)
         renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]