2010-03-25 16:37:37 +00:00
|
|
|
diff -up system-config-printer-1.2.0/asyncipp.py.asyncipp-traceback system-config-printer-1.2.0/asyncipp.py
|
2010-03-26 12:53:25 +00:00
|
|
|
--- system-config-printer-1.2.0/asyncipp.py.asyncipp-traceback 2010-03-26 12:50:39.829627667 +0000
|
|
|
|
+++ system-config-printer-1.2.0/asyncipp.py 2010-03-26 12:50:51.888627367 +0000
|
2010-03-26 10:27:50 +00:00
|
|
|
@@ -59,6 +59,7 @@ class _IPPConnectionThread(threading.Thr
|
|
|
|
self._auth_handler = auth_handler
|
|
|
|
self._auth_queue = Queue.Queue (1)
|
|
|
|
self.user = None
|
|
|
|
+ self._destroyed = False
|
|
|
|
debugprint ("+%s" % self)
|
|
|
|
|
|
|
|
def __del__ (self):
|
|
|
|
@@ -157,6 +158,7 @@ class _IPPConnectionThread(threading.Thr
|
|
|
|
self._queue.task_done ()
|
|
|
|
|
|
|
|
debugprint ("Thread exiting")
|
|
|
|
+ self._destroyed = True
|
|
|
|
del self._conn # already destroyed
|
|
|
|
del self._reply_handler
|
|
|
|
del self._error_handler
|
2010-03-26 12:53:25 +00:00
|
|
|
@@ -188,21 +190,23 @@ class _IPPConnectionThread(threading.Thr
|
|
|
|
return password
|
2010-03-25 16:37:37 +00:00
|
|
|
|
|
|
|
def _reply (self, result):
|
2010-03-26 12:53:25 +00:00
|
|
|
- def send_reply (result):
|
2010-03-25 16:37:37 +00:00
|
|
|
- self._reply_handler (self._conn, result)
|
2010-03-26 12:53:25 +00:00
|
|
|
+ def send_reply (handler, result):
|
|
|
|
+ if not self._destroyed:
|
|
|
|
+ handler (self._conn, result)
|
2010-03-25 16:37:37 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
- if self._reply_handler:
|
2010-03-26 12:53:25 +00:00
|
|
|
- gobject.idle_add (send_reply, result)
|
2010-03-26 10:27:50 +00:00
|
|
|
+ if not self._destroyed and self._reply_handler:
|
2010-03-26 12:53:25 +00:00
|
|
|
+ gobject.idle_add (send_reply, self._reply_handler, result)
|
2010-03-25 16:37:37 +00:00
|
|
|
|
|
|
|
def _error (self, exc):
|
2010-03-26 12:53:25 +00:00
|
|
|
- def send_error (exc):
|
2010-03-25 16:37:37 +00:00
|
|
|
- self._error_handler (self._conn, exc)
|
2010-03-26 12:53:25 +00:00
|
|
|
+ def send_error (handler, exc):
|
|
|
|
+ if not self._destroyed:
|
|
|
|
+ handler (self._conn, exc)
|
2010-03-25 16:37:37 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
- if self._error_handler:
|
2010-03-26 10:27:50 +00:00
|
|
|
+ if not self._destroyed and self._error_handler:
|
|
|
|
debugprint ("Add %s to idle" % self._error_handler)
|
2010-03-26 12:53:25 +00:00
|
|
|
- gobject.idle_add (send_error, exc)
|
|
|
|
+ gobject.idle_add (send_error, self._error_handler, exc)
|
2010-03-25 16:37:37 +00:00
|
|
|
|
2010-03-26 12:53:25 +00:00
|
|
|
###
|
|
|
|
### This is the user-visible class. Although it does not inherit from
|