From: Oliver Kurth Date: Tue, 19 Jun 2018 18:07:45 +0000 (-0700) Subject: Clipboard content on the host gets loaded to tmp on Linux guest with a right click... X-Git-Tag: stable-10.3.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99df5712ba7b8910c3db138c64aab6957f31c914;p=thirdparty%2Fopen-vm-tools.git Clipboard content on the host gets loaded to tmp on Linux guest with a right click on Guest Root Cause: Dndcp plugin creates a sub thread to monitor if there is other application access the specific file. The root cause for this bug is the main thread doesn't update its field before wakeup the sub thread, this cause the sub thread get a wrong value. Solution: Main thread should update the field before wakeup 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;