]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Clipboard content on the host gets loaded to tmp on Linux guest with a right click...
authorOliver Kurth <okurth@vmware.com>
Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)
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.

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;