summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-10-08 17:31:30 -0400
committerLance Stout <lancestout@gmail.com>2011-10-08 17:31:30 -0400
commit335dc2927bf874aa3ee3d4154257040b3b59db1a (patch)
tree067c15ac5713fed951dd0d9d09db79fa8f7a6327 /sleekxmpp/xmlstream/xmlstream.py
parentccbef6b6968b4d50192b290404869e18d33c8414 (diff)
downloadslixmpp-335dc2927bf874aa3ee3d4154257040b3b59db1a.tar.gz
slixmpp-335dc2927bf874aa3ee3d4154257040b3b59db1a.tar.bz2
slixmpp-335dc2927bf874aa3ee3d4154257040b3b59db1a.tar.xz
slixmpp-335dc2927bf874aa3ee3d4154257040b3b59db1a.zip
Break reference cycle to fix potential memory leaks for callback handlers.
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 0a66a974..8abbb3a1 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -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):
"""