Break reference cycle to fix potential memory leaks for callback handlers.

This commit is contained in:
Lance Stout
2011-10-08 17:31:30 -04:00
parent ccbef6b696
commit 335dc2927b
3 changed files with 10 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ import threading
import time
import types
import random
import weakref
try:
import queue
except ImportError:
@@ -719,7 +720,7 @@ class XMLStream(object):
"""
if handler.stream is None:
self.__handlers.append(handler)
handler.stream = self
handler.stream = weakref.ref(self)
def remove_handler(self, name):
"""