diff options
author | Lance Stout <lancestout@gmail.com> | 2011-10-08 17:31:30 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-10-08 17:31:30 -0400 |
commit | 335dc2927bf874aa3ee3d4154257040b3b59db1a (patch) | |
tree | 067c15ac5713fed951dd0d9d09db79fa8f7a6327 /sleekxmpp/xmlstream/xmlstream.py | |
parent | ccbef6b6968b4d50192b290404869e18d33c8414 (diff) | |
download | slixmpp-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.py | 3 |
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): """ |