Index: /trunk/include/VBox/GuestHost/DragAndDrop.h
===================================================================
--- /trunk/include/VBox/GuestHost/DragAndDrop.h	(revision 59827)
+++ /trunk/include/VBox/GuestHost/DragAndDrop.h	(revision 59828)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2014-2015 Oracle Corporation
+ * Copyright (C) 2014-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -168,4 +168,6 @@
     RTCString m_strSrcPath;
     RTCString m_strTgtPath;
+    /** Whether the object is in "opened" state. */
+    bool      m_fOpen;
     /** Object (file/directory) mode. */
     uint32_t  m_fMode;
Index: /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
===================================================================
--- /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp	(revision 59827)
+++ /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp	(revision 59828)
@@ -53,12 +53,30 @@
     , m_strTgtPath(strDstPath)
     , m_fMode(fMode)
+    , m_fOpen(false)
     , m_cbSize(cbSize)
     , m_cbProcessed(0)
 {
+}
+
+DnDURIObject::~DnDURIObject(void)
+{
+    closeInternal();
+}
+
+void DnDURIObject::closeInternal(void)
+{
+    LogFlowThisFuncEnter();
+
+    if (!m_fOpen)
+        return;
+
     switch (m_Type)
     {
         case File:
+        {
+            RTFileClose(u.m_hFile);
             u.m_hFile = NIL_RTFILE;
             break;
+        }
 
         case Directory:
@@ -68,34 +86,6 @@
             break;
     }
-}
-
-DnDURIObject::~DnDURIObject(void)
-{
-    closeInternal();
-}
-
-void DnDURIObject::closeInternal(void)
-{
-    LogFlowThisFuncEnter();
-    switch (m_Type)
-    {
-        case File:
-        {
-            if (u.m_hFile != NIL_RTFILE)
-            {
-                int rc2 = RTFileClose(u.m_hFile);
-                AssertRC(rc2);
-
-                u.m_hFile = NIL_RTFILE;
-            }
-            break;
-        }
-
-        case Directory:
-            break;
-
-        default:
-            break;
-    }
+
+    m_fOpen = false;
 }
 
@@ -130,22 +120,5 @@
 bool DnDURIObject::IsOpen(void) const
 {
-    bool fIsOpen;
-
-    switch (m_Type)
-    {
-        case File:
-            fIsOpen = u.m_hFile != NIL_RTFILE;
-            break;
-
-        case Directory:
-            fIsOpen = true;
-            break;
-
-        default:
-            fIsOpen = false;
-            break;
-    }
-
-    return fIsOpen;
+    return m_fOpen;
 }
 
@@ -180,11 +153,11 @@
         && fOpen) /* Opening mode specified? */
     {
-        LogFlowThisFunc(("strPath=%s, fOpen=0x%x, enmType=%RU32, enmDest=%RU32\n",
-                         strPath.c_str(), fOpen, enmType, enmDest));
+        LogFlowThisFunc(("enmType=%RU32, strPath=%s, fOpen=0x%x, enmType=%RU32, enmDest=%RU32\n",
+                         enmType, strPath.c_str(), fOpen, enmType, enmDest));
         switch (enmType)
         {
             case File:
             {
-                if (u.m_hFile == NIL_RTFILE)
+                if (!m_fOpen)
                 {
                     /*
@@ -243,5 +216,8 @@
 
     if (RT_SUCCESS(rc))
-        m_Type = enmType;
+    {
+        m_Type  = enmType;
+        m_fOpen = true;
+    }
 
     LogFlowFuncLeaveRC(rc);
