From: Oliver Kurth Date: Fri, 27 Jul 2018 18:46:19 +0000 (-0700) Subject: Fix a bug where the clipboard content on the host gets loaded to tmp on X-Git-Tag: stable-11.0.0~530 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1965add45fc265bd295480c00bfe4d8248abea3c;p=thirdparty%2Fopen-vm-tools.git Fix a bug where the clipboard content on the host gets loaded to tmp on the Linux guest with a right click on the guest Root Cause: Dndcp plugin creates a sub thread to monitor if there is another application access to the specific file. The root cause for this bug is the main thread doesn't update its field before wakeup of the sub thread, this cause the sub thread get a wrong value. Solution: Main thread should update the field before waking up the sub thread. --- diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp index d046b8b60..6c40b84a1 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp @@ -243,10 +243,10 @@ CopyPasteUIX11::~CopyPasteUIX11() if (mBlockAdded) { g_debug("%s: removing block for %s\n", __FUNCTION__, mHGStagingDir.c_str()); /* We need to make sure block subsystem has not been shut off. */ + mBlockAdded = false; if (DnD_BlockIsReady(mBlockCtrl)) { mBlockCtrl->RemoveBlock(mBlockCtrl->fd, mHGStagingDir.c_str()); } - mBlockAdded = false; } TerminateThread(); @@ -1198,9 +1198,9 @@ CopyPasteUIX11::GetRemoteClipboardCB(const CPClipboard *clip) // IN } if (mBlockAdded) { + mBlockAdded = false; if (DnD_BlockIsReady(mBlockCtrl)) { mBlockCtrl->RemoveBlock(mBlockCtrl->fd, mHGStagingDir.c_str()); - mBlockAdded = false; } } @@ -1552,10 +1552,10 @@ CopyPasteUIX11::GetLocalFilesDone(bool success) if (mBlockAdded) { g_debug("%s: removing block for %s\n", __FUNCTION__, mHGStagingDir.c_str()); /* We need to make sure block subsystem has not been shut off. */ + mBlockAdded = false; if (DnD_BlockIsReady(mBlockCtrl)) { mBlockCtrl->RemoveBlock(mBlockCtrl->fd, mHGStagingDir.c_str()); } - mBlockAdded = false; } mHGGetFileStatus = DND_FILE_TRANSFER_FINISHED;