From ccbd6ad392fb26ba6b9452129cf635d168b352a8 Mon Sep 17 00:00:00 2001 From: imdano <> Date: Fri, 19 Sep 2008 16:28:26 +0000 Subject: [PATCH] experimental: - Fix potential deadlock in connection thread - Make wireless interface blank string if set to None in config. --- wicd/networking.py | 10 ++++++---- wicd/wicd-daemon.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wicd/networking.py b/wicd/networking.py index 9ebde85..21d0c22 100644 --- a/wicd/networking.py +++ b/wicd/networking.py @@ -227,9 +227,12 @@ class ConnectThread(threading.Thread): def set_should_die(self, val): self.lock.acquire() - self._should_die = val + try: + self._should_die = val + finally: + self.lock.release() - should_die = property(should_die, get_should_die, set_should_die) + should_die = property(get_should_die, set_should_die) def SetStatus(self, status): @@ -352,7 +355,7 @@ class ConnectThread(threading.Thread): """ if self.abort_reason: reason = self.abort_reason - self.SetStatus(reason) + self.connecting_message = reason self.is_aborted = True self.abort_msg = reason self.is_connecting = False @@ -381,7 +384,6 @@ class ConnectThread(threading.Thread): try: if self._should_die: self.connect_aborted('aborted') - self.lock.release() thread.exit() finally: self.lock.release() diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 83af013..9d22185 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -140,8 +140,8 @@ class WicdDaemon(dbus.service.Object): def SetWirelessInterface(self, interface): """ Sets the wireless interface the daemon will use. """ print "setting wireless interface %s" % (str(interface)) - self.wifi.wireless_interface = interface - self.wired.wireless_interface = interface + self.wifi.wireless_interface = noneToBlankString(interface) + self.wired.wireless_interface = noneToBlankString(interface) self.config.set("Settings", "wireless_interface", interface, True) @dbus.service.method('org.wicd.daemon')