From 70af52d74c3f4253791120be4016f108aa966b4d Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sun, 13 Feb 2011 16:28:06 -0500 Subject: Make one-off Callbacks ready for deletion after the prerun step. Waiting until the actual run step means that the handler is not marked for deletion when checked in the __spawn_event() thread, causing the callback to stay in the handler list. --- sleekxmpp/xmlstream/handler/callback.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sleekxmpp/xmlstream/handler/callback.py') diff --git a/sleekxmpp/xmlstream/handler/callback.py b/sleekxmpp/xmlstream/handler/callback.py index f0a72853..cfd3c43c 100644 --- a/sleekxmpp/xmlstream/handler/callback.py +++ b/sleekxmpp/xmlstream/handler/callback.py @@ -62,6 +62,8 @@ class Callback(BaseHandler): payload -- The matched stanza object. """ BaseHandler.prerun(self, payload) + if self._once: + self._destroy = True if self._instream: self.run(payload, True) -- cgit v1.2.3 From 9004e8bbf2c29d23fad20467791d9a8224d4bdb3 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 14 Feb 2011 11:13:41 -0500 Subject: Break references that can prevent garbage collection. --- sleekxmpp/xmlstream/handler/callback.py | 1 + 1 file changed, 1 insertion(+) (limited to 'sleekxmpp/xmlstream/handler/callback.py') diff --git a/sleekxmpp/xmlstream/handler/callback.py b/sleekxmpp/xmlstream/handler/callback.py index cfd3c43c..f1fda805 100644 --- a/sleekxmpp/xmlstream/handler/callback.py +++ b/sleekxmpp/xmlstream/handler/callback.py @@ -84,3 +84,4 @@ class Callback(BaseHandler): self._pointer(payload) if self._once: self._destroy = True + del self._pointer -- cgit v1.2.3 From e0f9025e7c6fe51243222aeb684b94eda1a2be5f Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 14 Feb 2011 11:30:04 -0500 Subject: More attempts at fixing garbage collection. Don't keep a reference to stanzas in Callback objects. --- sleekxmpp/xmlstream/handler/callback.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'sleekxmpp/xmlstream/handler/callback.py') diff --git a/sleekxmpp/xmlstream/handler/callback.py b/sleekxmpp/xmlstream/handler/callback.py index f1fda805..7fadab43 100644 --- a/sleekxmpp/xmlstream/handler/callback.py +++ b/sleekxmpp/xmlstream/handler/callback.py @@ -61,7 +61,6 @@ class Callback(BaseHandler): Arguments: payload -- The matched stanza object. """ - BaseHandler.prerun(self, payload) if self._once: self._destroy = True if self._instream: @@ -80,7 +79,6 @@ class Callback(BaseHandler): Defaults to False. """ if not self._instream or instream: - BaseHandler.run(self, payload) self._pointer(payload) if self._once: self._destroy = True -- cgit v1.2.3