From 8c4d931686ab14d71dc65a7a4b43f772c88c6a12 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 3 Dec 2013 12:23:47 +0000 Subject: [PATCH] #452 detect clipboard loops and disable clipboard temporarily git-svn-id: https://xpra.org/svn/Xpra/trunk@4845 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/clipboard/clipboard_base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xpra/clipboard/clipboard_base.py b/src/xpra/clipboard/clipboard_base.py index 6a8f4ebdfc..b5e5947b50 100644 --- a/src/xpra/clipboard/clipboard_base.py +++ b/src/xpra/clipboard/clipboard_base.py @@ -540,6 +540,14 @@ def do_selection_get(self, selection_data, info, time): assert self._selection == str(selection_data.selection) target = str(selection_data.target) self._request_contents_events += 1 + #check for clipboard loops: + if gtk.main_level()>=20: + log.warn("clipboard loop nesting too deep: %s", gtk.main_level()) + log.warn("you may have a clipboard forwarding loop, temporarily disabling the clipboard") + log.warn("it may be best to disable the clipboard completely") + self.set_enabled(False) + gobject.timeout_add(60*1000, self.set_enabled, True) + return result = self.emit("get-clipboard-from-remote", self._selection, target) if result is None or result["type"] is None: debug("remote selection fetch timed out or empty")