mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Fix issue that could happen when the deferreds created in the connection
manager fire after the dialog has been closed
This commit is contained in:
parent
5ad7c60b65
commit
b18d9cfed4
1 changed files with 14 additions and 0 deletions
|
@ -150,7 +150,9 @@ class ConnectionManager(component.Component):
|
||||||
|
|
||||||
self.__update_list()
|
self.__update_list()
|
||||||
|
|
||||||
|
self.running = True
|
||||||
response = self.connection_manager.run()
|
response = self.connection_manager.run()
|
||||||
|
self.running = False
|
||||||
|
|
||||||
# Save the toggle options
|
# Save the toggle options
|
||||||
self.__save_options()
|
self.__save_options()
|
||||||
|
@ -231,8 +233,14 @@ class ConnectionManager(component.Component):
|
||||||
def __update_list(self):
|
def __update_list(self):
|
||||||
"""Updates the host status"""
|
"""Updates the host status"""
|
||||||
def on_connect(result, c, host_id):
|
def on_connect(result, c, host_id):
|
||||||
|
# Return if the deferred callback was done after the dialog was closed
|
||||||
|
if not self.running:
|
||||||
|
return
|
||||||
|
|
||||||
row = self.__get_host_row(host_id)
|
row = self.__get_host_row(host_id)
|
||||||
def on_info(info, c):
|
def on_info(info, c):
|
||||||
|
if not self.running:
|
||||||
|
return
|
||||||
if row:
|
if row:
|
||||||
row[HOSTLIST_COL_STATUS] = "Online"
|
row[HOSTLIST_COL_STATUS] = "Online"
|
||||||
row[HOSTLIST_COL_VERSION] = info
|
row[HOSTLIST_COL_VERSION] = info
|
||||||
|
@ -240,6 +248,8 @@ class ConnectionManager(component.Component):
|
||||||
c.disconnect()
|
c.disconnect()
|
||||||
|
|
||||||
def on_info_fail(reason):
|
def on_info_fail(reason):
|
||||||
|
if not self.running:
|
||||||
|
return
|
||||||
if row:
|
if row:
|
||||||
row[HOSTLIST_COL_STATUS] = "Offline"
|
row[HOSTLIST_COL_STATUS] = "Offline"
|
||||||
self.__update_buttons()
|
self.__update_buttons()
|
||||||
|
@ -249,6 +259,8 @@ class ConnectionManager(component.Component):
|
||||||
d.addErrback(on_info_fail)
|
d.addErrback(on_info_fail)
|
||||||
|
|
||||||
def on_connect_failed(reason, host_info):
|
def on_connect_failed(reason, host_info):
|
||||||
|
if not self.running:
|
||||||
|
return
|
||||||
row = self.__get_host_row(host_id)
|
row = self.__get_host_row(host_id)
|
||||||
if row:
|
if row:
|
||||||
row[HOSTLIST_COL_STATUS] = "Offline"
|
row[HOSTLIST_COL_STATUS] = "Offline"
|
||||||
|
@ -262,6 +274,8 @@ class ConnectionManager(component.Component):
|
||||||
password = row[HOSTLIST_COL_PASS]
|
password = row[HOSTLIST_COL_PASS]
|
||||||
if client.connected() and (host, port, user) == client.connection_info():
|
if client.connected() and (host, port, user) == client.connection_info():
|
||||||
def on_info(info):
|
def on_info(info):
|
||||||
|
if not self.running:
|
||||||
|
return
|
||||||
row[HOSTLIST_COL_VERSION] = info
|
row[HOSTLIST_COL_VERSION] = info
|
||||||
self.__update_buttons()
|
self.__update_buttons()
|
||||||
row[HOSTLIST_COL_STATUS] = "Connected"
|
row[HOSTLIST_COL_STATUS] = "Connected"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue