Index: trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 78564)
+++ trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 78565)
@@ -4337,4 +4337,7 @@
                         tr("Setting passthrough rejected as the device attached to device slot %d on port %d of controller '%s' is not a DVD"),
                         aDevice, aControllerPort, aName.c_str());
+
+    bool fValueChanged = pAttach->i_getPassthrough() != (aPassthrough != 0);
+
     pAttach->i_updatePassthrough(!!aPassthrough);
 
@@ -4342,5 +4345,5 @@
     alock.release();
     rc = i_onStorageDeviceChange(pAttach, FALSE /* aRemove */, FALSE /* aSilent */);
-    if (SUCCEEDED(rc))
+    if (SUCCEEDED(rc) && fValueChanged)
         mParent->i_onStorageDeviceChanged(pAttach, FALSE, FALSE);
 
@@ -6157,4 +6160,5 @@
     if (FAILED(rc)) return rc;
 
+    MediumAttachmentList llDetachedAttachments;
     {
         /* find all attached devices to the appropriate storage controller and detach them all */
@@ -6177,8 +6181,18 @@
             if (pAttachTemp->i_getControllerName() == aName)
             {
+                llDetachedAttachments.push_back(pAttachTemp);
                 rc = i_detachDevice(pAttachTemp, alock, NULL);
                 if (FAILED(rc)) return rc;
             }
         }
+    }
+
+    /* send event about detached devices before removing parent controller */
+    for (MediumAttachmentList::const_iterator
+         it = llDetachedAttachments.begin();
+         it != llDetachedAttachments.end();
+         ++it)
+    {
+        mParent->i_onStorageDeviceChanged(*it, TRUE, FALSE);
     }
 
Index: trunk/src/VBox/Main/src-server/MediumImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 78564)
+++ trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 78565)
@@ -2336,5 +2336,5 @@
     pVirtualBox->i_saveModifiedRegistries();
 
-    if (SUCCEEDED(mrc))
+    if (SUCCEEDED(mrc) && uId.isValid() && !uId.isZero())
         pVirtualBox->i_onMediumRegistered(uId, devType, FALSE);
 
@@ -8414,5 +8414,8 @@
 
     if (task.NotifyAboutChanges() && SUCCEEDED(rc))
+    {
         m->pVirtualBox->i_onMediumConfigChanged(this);
+        m->pVirtualBox->i_onMediumRegistered(m->id, m->devType, TRUE);
+    }
 
     return rc;
@@ -8641,5 +8644,8 @@
 
     if (task.NotifyAboutChanges() && SUCCEEDED(mrc))
+    {
         m->pVirtualBox->i_onMediumConfigChanged(this);
+        m->pVirtualBox->i_onMediumRegistered(m->id, m->devType, TRUE);
+    }
 
     return mrc;
@@ -9650,8 +9656,13 @@
 
     /* Reset UUID to prevent Create* from reusing it again */
+    com::Guid uOldId = m->id;
     unconst(m->id).clear();
 
-    if (task.NotifyAboutChanges() && SUCCEEDED(rc) && m->pParent.isNotNull())
-        m->pVirtualBox->i_onMediumConfigChanged(m->pParent);
+    if (task.NotifyAboutChanges() && SUCCEEDED(rc))
+    {
+        if (m->pParent.isNotNull())
+            m->pVirtualBox->i_onMediumConfigChanged(m->pParent);
+        m->pVirtualBox->i_onMediumRegistered(uOldId, m->devType, TRUE);
+    }
 
     return rc;
Index: trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/SnapshotImpl.cpp	(revision 78564)
+++ trunk/src/VBox/Main/src-server/SnapshotImpl.cpp	(revision 78565)
@@ -3234,5 +3234,5 @@
                     else
                     {
-                        for (ComObjPtr<Medium> pTmpMedium = it->mpSource->i_getParent();
+                        for (ComObjPtr<Medium> pTmpMedium = it->mpSource;
                              pTmpMedium && pTmpMedium != it->mpTarget;
                              pTmpMedium = pTmpMedium->i_getParent())
Index: trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 78564)
+++ trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 78565)
@@ -1978,5 +1978,7 @@
     {
         medium.queryInterfaceTo(aMedium.asOutParam());
-        i_onMediumRegistered(medium->i_getId(), medium->i_getDeviceType(), TRUE);
+        com::Guid uMediumId = medium->i_getId();
+        if (uMediumId.isValid() && !uMediumId.isZero())
+            i_onMediumRegistered(uMediumId, medium->i_getDeviceType(), TRUE);
     }
 
