]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix a bug where the clipboard content on the host gets loaded to tmp on
authorOliver Kurth <okurth@vmware.com>
Fri, 27 Jul 2018 18:46:19 +0000 (11:46 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 27 Jul 2018 18:46:19 +0000 (11:46 -0700)
   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.

open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp

index d046b8b609cfb2c2149ba2f837a395b3d90aefd7..6c40b84a1d7c8a765ae876335c6ac89a753c5e69 100644 (file)
@@ -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;