Index: /trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/VBoxHDD.cpp	(revision 29496)
+++ /trunk/src/VBox/Devices/Storage/VBoxHDD.cpp	(revision 29497)
@@ -1459,5 +1459,5 @@
                                                          pTmp, 1,
                                                          pIoCtx, cbThisWrite,
-                                                         pTmp, 
+                                                         pTmp,
                                                            (pImage->uOpenFlags & VD_OPEN_FLAGS_HONOR_SAME)
                                                          ? vdWriteHelperStandardAsync
@@ -1840,5 +1840,5 @@
                 if (RT_FAILURE(pIoCtx->rcReq))
                     ASMAtomicCmpXchgS32(&pIoCtxParent->rcReq, pIoCtx->rcReq, VINF_SUCCESS);
- 
+
                 /*
                  * A completed child write means that we finsihed growing the image.
@@ -3937,5 +3937,4 @@
 
         RTUUID ImageUuid, ImageModificationUuid;
-        RTUUID ParentUuid, ParentModificationUuid;
         if (pDiskFrom != pDiskTo)
         {
@@ -3954,10 +3953,4 @@
         if (RT_FAILURE(rc))
             RTUuidClear(&ImageModificationUuid);
-        rc = pImageFrom->Backend->pfnGetParentUuid(pImageFrom->pvBackendData, &ParentUuid);
-        if (RT_FAILURE(rc))
-            RTUuidClear(&ParentUuid);
-        rc = pImageFrom->Backend->pfnGetParentModificationUuid(pImageFrom->pvBackendData, &ParentModificationUuid);
-        if (RT_FAILURE(rc))
-            RTUuidClear(&ParentModificationUuid);
 
         char szComment[1024];
@@ -3975,4 +3968,10 @@
         fLockReadFrom = false;
 
+        rc2 = vdThreadStartRead(pDiskTo);
+        AssertRC(rc2);
+        unsigned cImagesTo = pDiskTo->cImages;
+        rc2 = vdThreadFinishRead(pDiskTo);
+        AssertRC(rc2);
+
         if (pszFilename)
         {
@@ -3980,12 +3979,15 @@
                 cbSize = cbSizeFrom;
 
-            /* Create destination image with the properties of the source image. */
+            /* Create destination image with the properties of source image. */
             /** @todo replace the VDCreateDiff/VDCreateBase calls by direct
              * calls to the backend. Unifies the code and reduces the API
              * dependencies. Would also make the synchronization explicit. */
-            if (uImageFlags & VD_IMAGE_FLAGS_DIFF)
+            if (cImagesTo > 0)
             {
-                rc = VDCreateDiff(pDiskTo, pszBackend, pszFilename, uImageFlags,
-                                  szComment, &ImageUuid, &ParentUuid, uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY, NULL, NULL);
+                rc = VDCreateDiff(pDiskTo, pszBackend, pszFilename,
+                                  uImageFlags, szComment, &ImageUuid,
+                                  NULL /* pParentUuid */,
+                                  uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY,
+                                  NULL, NULL);
 
                 rc2 = vdThreadStartWrite(pDiskTo);
@@ -4024,6 +4026,4 @@
                 if (RT_SUCCESS(rc) && !RTUuidIsNull(&ImageUuid))
                      pDiskTo->pLast->Backend->pfnSetUuid(pDiskTo->pLast->pvBackendData, &ImageUuid);
-                if (RT_SUCCESS(rc) && !RTUuidIsNull(&ParentUuid))
-                     pDiskTo->pLast->Backend->pfnSetParentUuid(pDiskTo->pLast->pvBackendData, &ParentUuid);
             }
             if (RT_FAILURE(rc))
@@ -4138,9 +4138,4 @@
             if (!RTUuidIsNull(&ImageModificationUuid))
                 pImageTo->Backend->pfnSetModificationUuid(pImageTo->pvBackendData, &ImageModificationUuid);
-            /** @todo double-check this - it makes little sense to copy over the parent modification uuid,
-             * as the destination image can have a totally different parent. */
-#if 0
-            pImageTo->Backend->pfnSetParentModificationUuid(pImageTo->pvBackendData, &ParentModificationUuid);
-#endif
         }
     } while (0);
