lock: clear postrelease hooks list after usage
Post release hooks should only be called once. Setting the
list to None after usage will prevent accidental usage after
they are used.
In addition, it is easy for reference cycles to sneak into hook
functions. Clearing the hooks after usage helps prevent these
cycles.
--- a/mercurial/lock.py Sun Mar 27 21:05:55 2016 +0900
+++ b/mercurial/lock.py Sat Apr 16 09:00:15 2016 -0700
@@ -234,6 +234,8 @@
if not self._parentheld:
for callback in self.postrelease:
callback()
+ # Prevent double usage and help clear cycles.
+ self.postrelease = None
def release(*locks):
for lock in locks: