Skip to content

Commit

Permalink
#812: failures to remove the timer_clipboard_check during cleanup sho…
Browse files Browse the repository at this point in the history
…uld not be a problem

git-svn-id: https://xpra.org/svn/Xpra/trunk@22508 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 22, 2019
1 parent 4c68ed9 commit 09ec517
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/xpra/platform/darwin/osx_clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,22 @@ def __init__(self, selection, pasteboard, send_clipboard_request_handler, send_c
self.send_clipboard_token_handler = send_clipboard_token_handler
ClipboardProxyCore.__init__(self, selection)
self.update_change_count()
self.setup_watcher()

def cleanup(self):
ClipboardProxyCore.cleanup(self)
self.remove_watcher()

def setup_watcher(self):
#setup clipboard counter watcher:
w = get_UI_watcher(glib.timeout_add)
if w is None:
log.warn("Warning: no UI watcher instance available")
log.warn(" cannot detect clipboard change events")
else:
log("UI watcher=%s", w)
w.add_alive_callback(self.timer_clipboard_check)

def remove_watcher(self):
def cleanup(self):
ClipboardProxyCore.cleanup(self)
w = get_UI_watcher(glib.timeout_add)
if w:
w.remove_alive_callback(self.timer_clipboard_check)
try:
w.remove_alive_callback(self.timer_clipboard_check)
except KeyError:
pass

def timer_clipboard_check(self):
c = self.change_count
Expand Down

0 comments on commit 09ec517

Please sign in to comment.