[kupfer] pidgin: Don't crash on Pidgin quit



commit 049e6aca1446480ce47eae1d0bcf57d7c7251669
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Jan 5 18:02:14 2010 +0100

    pidgin: Don't crash on Pidgin quit
    
    Be more careful in the sign off signal handler; upon any D-Bus
    exception, we clear the buddy list (we take it as a sign that Pidgin
    already quit).

 kupfer/plugin/pidgin.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/pidgin.py b/kupfer/plugin/pidgin.py
index 54a82e5..8432e33 100644
--- a/kupfer/plugin/pidgin.py
+++ b/kupfer/plugin/pidgin.py
@@ -208,9 +208,15 @@ class ContactsSource(AppLeafContentMixin, Source, PicklingHelperMixin):
 			return
 		interface = _create_dbus_connection()
 		if interface is None:
+			self.all_buddies = {}
 			return
 
-		accounts = interface.PurpleAccountsGetAllActive()
+		try:
+			# extra careful as this will fail when Pidgin is Quitting
+			accounts = interface.PurpleAccountsGetAllActive()
+		except dbus.DBusException:
+			self.all_buddies = {}
+			return
 		is_disconnected = interface.PurpleAccountIsDisconnected
 		conn_accounts = set(a for a in accounts if not is_disconnected(a))
 		for buddy, pcontact in self.all_buddies.items():



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]