From: Pierre Ossman Date: Mon, 1 Mar 2021 14:46:35 +0000 (+0100) Subject: Drop other selection on ownership change X-Git-Tag: v1.11.90~66 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=18cc32454337fe6a6300ec1e5428a4aa7baef547;p=tigervnc.git Drop other selection on ownership change Otherwise we might end up owners of something we cannot deliver data on, which can hang applications. --- diff --git a/unix/xserver/hw/vnc/vncSelection.c b/unix/xserver/hw/vnc/vncSelection.c index 5191bb94..a1af467a 100644 --- a/unix/xserver/hw/vnc/vncSelection.c +++ b/unix/xserver/hw/vnc/vncSelection.c @@ -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;