]> source.dussan.org Git - tigervnc.git/commitdiff
Drop other selection on ownership change
authorPierre Ossman <ossman@cendio.se>
Mon, 1 Mar 2021 14:46:35 +0000 (15:46 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 1 Mar 2021 14:46:35 +0000 (15:46 +0100)
Otherwise we might end up owners of something we cannot deliver data on,
which can hang applications.

unix/xserver/hw/vnc/vncSelection.c

index 5191bb94d89814e975949910bcccbd2e4f91b1ce..a1af467ab4380ea64b67f5cca8b19ee68529a8f5 100644 (file)
@@ -608,6 +608,13 @@ static void vncSelectionCallback(CallbackListPtr *callbacks,
   LOG_DEBUG("Selection owner change for %s",
             NameForAtom(info->selection->selection));
 
+  /*
+   * If we're the previous owner of this selection, then we're also the
+   * owner of _the other_ selection. Make sure we drop all ownerships so
+   * we either own both selections or nonw.
+   */
+  DeleteWindowFromAnySelections(pWindow);
+
   if ((info->selection->selection != xaPRIMARY) &&
       (info->selection->selection != xaCLIPBOARD))
     return;