From 8e3d737adcb1ce0074150daf994cd51c3ece4da1 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 31 Aug 2015 10:06:41 +0100 Subject: [PATCH] [#2731] [GTKUI] Fix potential AttributeError in is_on_active_workspace * Without being able to replicate adding the forced updated is the likely fix for 'win' being None but also add test in case it's not... --- deluge/ui/gtkui/mainwindow.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py index 86b95a5fd..6e2f30ff1 100644 --- a/deluge/ui/gtkui/mainwindow.py +++ b/deluge/ui/gtkui/mainwindow.py @@ -312,11 +312,13 @@ class MainWindow(component.Component): bool: True if on active workspace (or wnck module not available), otherwise False. """ - if not wnck: - return True - win = wnck.window_get(self.window.window.xid) - active_wksp = win.get_screen().get_active_workspace() - if active_wksp: - return win.is_on_workspace(active_wksp) - else: - return False + if wnck: + self.screen.force_update() + win = wnck.window_get(self.window.window.xid) + if win: + active_wksp = win.get_screen().get_active_workspace() + if active_wksp: + return win.is_on_workspace(active_wksp) + else: + return False + return True