Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 15990)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 15991)
@@ -2509,5 +2509,5 @@
 HRESULT Console::onDVDDriveChange()
 {
-    LogFlowThisFunc (("\n"));
+    LogFlowThisFuncEnter();
 
     AutoCaller autoCaller (this);
@@ -2578,21 +2578,20 @@
 
     AssertComRC (rc);
-    if (FAILED (rc))
-    {
-        LogFlowThisFunc (("Returns %#x\n", rc));
-        return rc;
-    }
-
-    rc = doDriveChange ("piix3ide", 0, 2, eState, &meDVDState,
-                        Utf8Str (Path).raw(), fPassthrough);
-
-    /* notify console callbacks on success */
     if (SUCCEEDED (rc))
     {
-        CallbackList::iterator it = mCallbacks.begin();
-        while (it != mCallbacks.end())
-            (*it++)->OnDVDDriveChange();
-    }
-
+        rc = doDriveChange ("piix3ide", 0, 2, eState, &meDVDState,
+                            Utf8Str (Path).raw(), fPassthrough);
+
+        /* notify console callbacks on success */
+        if (SUCCEEDED (rc))
+        {
+            CallbackList::iterator it = mCallbacks.begin();
+            while (it != mCallbacks.end())
+                (*it++)->OnDVDDriveChange();
+        }
+    }
+
+    LogFlowThisFunc (("Returns %Rhrc (%#x)\n", rc, rc));
+    LogFlowThisFuncLeave();
     return rc;
 }
@@ -2606,5 +2605,5 @@
 HRESULT Console::onFloppyDriveChange()
 {
-    LogFlowThisFunc (("\n"));
+    LogFlowThisFuncEnter();
 
     AutoCaller autoCaller (this);
@@ -2680,21 +2679,20 @@
 
     AssertComRC (rc);
-    if (FAILED (rc))
-    {
-        LogFlowThisFunc (("Returns %#x\n", rc));
-        return rc;
-    }
-
-    rc = doDriveChange ("i82078", 0, 0, eState, &meFloppyState,
-                        Utf8Str (Path).raw(), false);
-
-    /* notify console callbacks on success */
     if (SUCCEEDED (rc))
     {
-        CallbackList::iterator it = mCallbacks.begin();
-        while (it != mCallbacks.end())
-            (*it++)->OnFloppyDriveChange();
-    }
-
+        rc = doDriveChange ("i82078", 0, 0, eState, &meFloppyState,
+                            Utf8Str (Path).raw(), false);
+
+        /* notify console callbacks on success */
+        if (SUCCEEDED (rc))
+        {
+            CallbackList::iterator it = mCallbacks.begin();
+            while (it != mCallbacks.end())
+                (*it++)->OnFloppyDriveChange();
+        }
+    }
+
+    LogFlowThisFunc (("Returns %Rhrc (%#x)\n", rc, rc));
+    LogFlowThisFuncLeave();
     return rc;
 }
Index: /trunk/src/VBox/Main/DVDDriveImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/DVDDriveImpl.cpp	(revision 15990)
+++ /trunk/src/VBox/Main/DVDDriveImpl.cpp	(revision 15991)
@@ -29,4 +29,6 @@
 #include "VirtualBoxImpl.h"
 
+#include "Global.h"
+
 #include "Logging.h"
 
@@ -70,5 +72,5 @@
     /* mPeer is left null */
 
-    mData.allocate();
+    m.allocate();
 
     /* Confirm a successful initialization */
@@ -105,5 +107,5 @@
 
     AutoReadLock thatLock (aThat);
-    mData.share (aThat->mData);
+    m.share (aThat->m);
 
     /* Confirm a successful initialization */
@@ -137,14 +139,14 @@
 
     AutoReadLock thatLock (aThat);
-    mData.attachCopy (aThat->mData);
+    m.attachCopy (aThat->m);
 
     /* at present, this must be a snapshot machine */
     Assert (!aParent->snapshotId().isEmpty());
 
-    if (mData->mState == DriveState_ImageMounted)
+    if (m->state == DriveState_ImageMounted)
     {
         /* associate the DVD image media with the snapshot */
-        HRESULT rc = mData->mImage->attachTo (aParent->id(),
-                                              aParent->snapshotId());
+        HRESULT rc = m->image->attachTo (aParent->id(),
+                                         aParent->snapshotId());
         AssertComRC (rc);
     }
@@ -171,5 +173,5 @@
     if ((mParent->type() == Machine::IsMachine ||
          mParent->type() == Machine::IsSnapshotMachine) &&
-        mData->mState == DriveState_ImageMounted)
+        m->state == DriveState_ImageMounted)
     {
         /* Deassociate the DVD image (only when mParent is a real Machine or a
@@ -178,10 +180,10 @@
          * re-initialization of the VM after successfully re-checking the
          * accessibility state. */
-        HRESULT rc = mData->mImage->detachFrom (mParent->id(),
-                                                mParent->snapshotId());
+        HRESULT rc = m->image->detachFrom (mParent->id(),
+                                           mParent->snapshotId());
         AssertComRC (rc);
     }
 
-    mData.free();
+    m.free();
 
     unconst (mPeer).setNull();
@@ -201,5 +203,5 @@
     AutoReadLock alock (this);
 
-    *aState = mData->mState;
+    *aState = m->state;
 
     return S_OK;
@@ -215,5 +217,5 @@
     AutoReadLock alock (this);
 
-    *aPassthrough = mData->mPassthrough;
+    *aPassthrough = m->passthrough;
 
     return S_OK;
@@ -231,8 +233,8 @@
     AutoWriteLock alock (this);
 
-    if (mData->mPassthrough != aPassthrough)
-    {
-        mData.backup();
-        mData->mPassthrough = aPassthrough;
+    if (m->passthrough != aPassthrough)
+    {
+        m.backup();
+        m->passthrough = aPassthrough;
     }
 
@@ -268,6 +270,6 @@
     if (SUCCEEDED (rc))
     {
-        if (mData->mState != DriveState_ImageMounted ||
-            !mData->mImage.equalsTo (image))
+        if (m->state != DriveState_ImageMounted ||
+            !m->image.equalsTo (image))
         {
             rc = image->attachTo (mParent->id(), mParent->snapshotId());
@@ -276,8 +278,19 @@
                 /* umount() will backup data */
                 rc = unmount();
+
                 if (SUCCEEDED (rc))
                 {
-                    mData->mImage = image;
-                    mData->mState = DriveState_ImageMounted;
+                    /* lock the image for reading if the VM is online. It will
+                     * be unlocked either when unmounted from this drive or by
+                     * SessionMachine::setMachineState() when the VM is
+                     * terminated */
+                    if (Global::IsOnline (adep.machineState()))
+                        rc = image->LockRead (NULL);
+                }
+
+                if (SUCCEEDED (rc))
+                {
+                    m->image = image;
+                    m->state = DriveState_ImageMounted;
 
                     /* leave the lock before informing callbacks */
@@ -306,6 +319,6 @@
     AutoWriteLock alock (this);
 
-    if (mData->mState != DriveState_HostDriveCaptured ||
-        !mData->mHostDrive.equalsTo (aHostDVDDrive))
+    if (m->state != DriveState_HostDriveCaptured ||
+        !m->hostDrive.equalsTo (aHostDVDDrive))
     {
         /* umount() will backup data */
@@ -313,6 +326,6 @@
         if (SUCCEEDED (rc))
         {
-            mData->mHostDrive = aHostDVDDrive;
-            mData->mState = DriveState_HostDriveCaptured;
+            m->hostDrive = aHostDVDDrive;
+            m->state = DriveState_HostDriveCaptured;
 
             /* leave the lock before informing callbacks */
@@ -337,5 +350,5 @@
     AutoWriteLock alock (this);
 
-    if (mData->mState != DriveState_NotMounted)
+    if (m->state != DriveState_NotMounted)
     {
         /* umount() will backup data */
@@ -343,5 +356,5 @@
         if (SUCCEEDED (rc))
         {
-            mData->mState = DriveState_NotMounted;
+            m->state = DriveState_NotMounted;
 
             /* leave the lock before informing callbacks */
@@ -364,5 +377,5 @@
     AutoReadLock alock (this);
 
-    mData->mImage.queryInterfaceTo (aDVDImage);
+    m->image.queryInterfaceTo (aDVDImage);
 
     return S_OK;
@@ -378,5 +391,5 @@
     AutoReadLock alock (this);
 
-    mData->mHostDrive.queryInterfaceTo (aHostDrive);
+    m->hostDrive.queryInterfaceTo (aHostDrive);
 
     return S_OK;
@@ -422,5 +435,5 @@
 
     /* optional, defaults to false */
-    mData->mPassthrough = dvdDriveNode.value <bool> ("passthrough");
+    m->passthrough = dvdDriveNode.value <bool> ("passthrough");
 
     Key typeNode;
@@ -490,14 +503,14 @@
     Key node = aMachineNode.createKey ("DVDDrive");
 
-    node.setValue <bool> ("passthrough", !!mData->mPassthrough);
-
-    switch (mData->mState)
+    node.setValue <bool> ("passthrough", !!m->passthrough);
+
+    switch (m->state)
     {
         case DriveState_ImageMounted:
         {
-            Assert (!mData->mImage.isNull());
+            Assert (!m->image.isNull());
 
             Guid id;
-            HRESULT rc = mData->mImage->COMGETTER(Id) (id.asOutParam());
+            HRESULT rc = m->image->COMGETTER(Id) (id.asOutParam());
             AssertComRC (rc);
             Assert (!id.isEmpty());
@@ -509,8 +522,8 @@
         case DriveState_HostDriveCaptured:
         {
-            Assert (!mData->mHostDrive.isNull());
+            Assert (!m->hostDrive.isNull());
 
             Bstr name;
-            HRESULT  rc = mData->mHostDrive->COMGETTER(Name) (name.asOutParam());
+            HRESULT  rc = m->hostDrive->COMGETTER(Name) (name.asOutParam());
             AssertComRC (rc);
             Assert (!name.isEmpty());
@@ -524,5 +537,5 @@
             break;
         default:
-            ComAssertMsgFailedRet (("Invalid drive state: %d", mData->mState),
+            ComAssertMsgFailedRet (("Invalid drive state: %d", m->state),
                                     E_FAIL);
     }
@@ -540,27 +553,38 @@
     AssertComRCReturn (autoCaller.rc(), false);
 
+    /* we need adep for the state check */
+    Machine::AutoAnyStateDependency adep (mParent);
+    AssertComRCReturn (adep.rc(), false);
+
     AutoWriteLock alock (this);
 
     bool changed = false;
 
-    if (mData.isBackedUp())
+    if (m.isBackedUp())
     {
         /* we need to check all data to see whether anything will be changed
          * after rollback */
-        changed = mData.hasActualChanges();
+        changed = m.hasActualChanges();
 
         if (changed)
         {
-            Data *oldData = mData.backedUpData();
-
-            if (!mData->mImage.isNull() &&
-                !oldData->mImage.equalsTo (mData->mImage))
+            Data *oldData = m.backedUpData();
+
+            if (!m->image.isNull() &&
+                !oldData->image.equalsTo (m->image))
             {
                 /* detach the current image that will go away after rollback */
-                mData->mImage->detachFrom (mParent->id(), mParent->snapshotId());
+                m->image->detachFrom (mParent->id(), mParent->snapshotId());
+
+                /* unlock the image for reading if the VM is online */
+                if (Global::IsOnline (adep.machineState()))
+                {
+                    HRESULT rc = m->image->UnlockRead (NULL);
+                    AssertComRC (rc);
+                }
             }
         }
 
-        mData.rollback();
+        m.rollback();
     }
 
@@ -582,24 +606,35 @@
     AssertComRCReturnVoid (peerCaller.rc());
 
+    /* we need adep for the state check */
+    Machine::AutoAnyStateDependency adep (mParent);
+    AssertComRCReturnVoid (adep.rc());
+
     /* lock both for writing since we modify both (mPeer is "master" so locked
      * first) */
     AutoMultiWriteLock2 alock (mPeer, this);
 
-    if (mData.isBackedUp())
-    {
-        Data *oldData = mData.backedUpData();
-
-        if (!oldData->mImage.isNull() &&
-            !oldData->mImage.equalsTo (mData->mImage))
+    if (m.isBackedUp())
+    {
+        Data *oldData = m.backedUpData();
+
+        if (!oldData->image.isNull() &&
+            !oldData->image.equalsTo (m->image))
         {
             /* detach the old image that will go away after commit */
-            oldData->mImage->detachFrom (mParent->id(), mParent->snapshotId());
-        }
-
-        mData.commit();
+            oldData->image->detachFrom (mParent->id(), mParent->snapshotId());
+
+            /* unlock the image for reading if the VM is online */
+            if (Global::IsOnline (adep.machineState()))
+            {
+                HRESULT rc = oldData->image->UnlockRead (NULL);
+                AssertComRC (rc);
+            }
+        }
+
+        m.commit();
         if (mPeer)
         {
             /* attach new data to the peer and reshare it */
-            mPeer->mData.attach (mData);
+            mPeer->m.attach (m);
         }
     }
@@ -627,5 +662,5 @@
 
     /* this will back up current data */
-    mData.assignCopy (aThat->mData);
+    m.assignCopy (aThat->m);
 }
 
@@ -639,12 +674,12 @@
     AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
 
-    mData.backup();
-
-    if (mData->mImage)
-        mData->mImage.setNull();
-    if (mData->mHostDrive)
-        mData->mHostDrive.setNull();
-
-    mData->mState = DriveState_NotMounted;
+    m.backup();
+
+    if (m->image)
+        m->image.setNull();
+    if (m->hostDrive)
+        m->hostDrive.setNull();
+
+    m->state = DriveState_NotMounted;
 
     return S_OK;
Index: /trunk/src/VBox/Main/FloppyDriveImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/FloppyDriveImpl.cpp	(revision 15990)
+++ /trunk/src/VBox/Main/FloppyDriveImpl.cpp	(revision 15991)
@@ -29,4 +29,6 @@
 #include "VirtualBoxImpl.h"
 
+#include "Global.h"
+
 #include "Logging.h"
 
@@ -70,5 +72,5 @@
     /* mPeer is left null */
 
-    mData.allocate();
+    m.allocate();
 
     /* Confirm a successful initialization */
@@ -105,5 +107,5 @@
 
     AutoReadLock thatLock (aThat);
-    mData.share (aThat->mData);
+    m.share (aThat->m);
 
     /* Confirm a successful initialization */
@@ -137,14 +139,14 @@
 
     AutoReadLock thatLock (aThat);
-    mData.attachCopy (aThat->mData);
+    m.attachCopy (aThat->m);
 
     /* at present, this must be a snapshot machine */
     Assert (!aParent->snapshotId().isEmpty());
 
-    if (mData->mState == DriveState_ImageMounted)
+    if (m->state == DriveState_ImageMounted)
     {
         /* associate the DVD image media with the snapshot */
-        HRESULT rc = mData->mImage->attachTo (aParent->id(),
-                                              aParent->snapshotId());
+        HRESULT rc = m->image->attachTo (aParent->id(),
+                                         aParent->snapshotId());
         AssertComRC (rc);
     }
@@ -171,5 +173,5 @@
     if ((mParent->type() == Machine::IsMachine ||
          mParent->type() == Machine::IsSnapshotMachine) &&
-        mData->mState == DriveState_ImageMounted)
+        m->state == DriveState_ImageMounted)
     {
         /* Deassociate the DVD image (only when mParent is a real Machine or a
@@ -178,10 +180,10 @@
          * re-initialization of the VM after successfully re-checking the
          * accessibility state. */
-        HRESULT rc = mData->mImage->detachFrom (mParent->id(),
-                                                mParent->snapshotId());
+        HRESULT rc = m->image->detachFrom (mParent->id(),
+                                           mParent->snapshotId());
         AssertComRC (rc);
     }
 
-    mData.free();
+    m.free();
 
     unconst (mPeer).setNull();
@@ -201,5 +203,5 @@
     AutoReadLock alock (this);
 
-    *aEnabled = mData->mEnabled;
+    *aEnabled = m->enabled;
 
     return S_OK;
@@ -219,8 +221,8 @@
     AutoWriteLock alock (this);
 
-    if (mData->mEnabled != aEnabled)
-    {
-        mData.backup();
-        mData->mEnabled = aEnabled;
+    if (m->enabled != aEnabled)
+    {
+        m.backup();
+        m->enabled = aEnabled;
 
         /* leave the lock before informing callbacks */
@@ -242,5 +244,5 @@
     AutoReadLock alock (this);
 
-    *aState = mData->mState;
+    *aState = m->state;
 
     return S_OK;
@@ -275,6 +277,6 @@
     if (SUCCEEDED (rc))
     {
-        if (mData->mState != DriveState_ImageMounted ||
-            !mData->mImage.equalsTo (image))
+        if (m->state != DriveState_ImageMounted ||
+            !m->image.equalsTo (image))
         {
             rc = image->attachTo (mParent->id(), mParent->snapshotId());
@@ -283,8 +285,19 @@
                 /* umount() will backup data */
                 rc = unmount();
+
                 if (SUCCEEDED (rc))
                 {
-                    mData->mImage = image;
-                    mData->mState = DriveState_ImageMounted;
+                    /* lock the image for reading if the VM is online. It will
+                     * be unlocked either when unmounted from this drive or by
+                     * SessionMachine::setMachineState() when the VM is
+                     * terminated */
+                    if (Global::IsOnline (adep.machineState()))
+                        rc = image->LockRead (NULL);
+                }
+
+                if (SUCCEEDED (rc))
+                {
+                    m->image = image;
+                    m->state = DriveState_ImageMounted;
 
                     /* leave the lock before informing callbacks */
@@ -313,6 +326,6 @@
     AutoWriteLock alock (this);
 
-    if (mData->mState != DriveState_HostDriveCaptured ||
-        !mData->mHostDrive.equalsTo (aHostFloppyDrive))
+    if (m->state != DriveState_HostDriveCaptured ||
+        !m->hostDrive.equalsTo (aHostFloppyDrive))
     {
         /* umount() will backup data */
@@ -320,6 +333,6 @@
         if (SUCCEEDED (rc))
         {
-            mData->mHostDrive = aHostFloppyDrive;
-            mData->mState = DriveState_HostDriveCaptured;
+            m->hostDrive = aHostFloppyDrive;
+            m->state = DriveState_HostDriveCaptured;
 
             /* leave the lock before informing callbacks */
@@ -344,5 +357,5 @@
     AutoWriteLock alock (this);
 
-    if (mData->mState != DriveState_NotMounted)
+    if (m->state != DriveState_NotMounted)
     {
         /* umount() will backup data */
@@ -350,5 +363,5 @@
         if (SUCCEEDED (rc))
         {
-            mData->mState = DriveState_NotMounted;
+            m->state = DriveState_NotMounted;
 
             /* leave the lock before informing callbacks */
@@ -371,5 +384,5 @@
     AutoReadLock alock (this);
 
-    mData->mImage.queryInterfaceTo (aFloppyImage);
+    m->image.queryInterfaceTo (aFloppyImage);
 
     return S_OK;
@@ -385,5 +398,5 @@
     AutoReadLock alock (this);
 
-    mData->mHostDrive.queryInterfaceTo (aHostDrive);
+    m->hostDrive.queryInterfaceTo (aHostDrive);
 
     return S_OK;
@@ -429,5 +442,5 @@
 
     /* optional, defaults to true */
-    mData->mEnabled = floppyDriveNode.value <bool> ("enabled");
+    m->enabled = floppyDriveNode.value <bool> ("enabled");
 
     Key typeNode;
@@ -497,14 +510,14 @@
     Key node = aMachineNode.createKey ("FloppyDrive");
 
-    node.setValue <bool> ("enabled", !!mData->mEnabled);
-
-    switch (mData->mState)
+    node.setValue <bool> ("enabled", !!m->enabled);
+
+    switch (m->state)
     {
         case DriveState_ImageMounted:
         {
-            Assert (!mData->mImage.isNull());
+            Assert (!m->image.isNull());
 
             Guid id;
-            HRESULT rc = mData->mImage->COMGETTER(Id) (id.asOutParam());
+            HRESULT rc = m->image->COMGETTER(Id) (id.asOutParam());
             AssertComRC (rc);
             Assert (!id.isEmpty());
@@ -516,8 +529,8 @@
         case DriveState_HostDriveCaptured:
         {
-            Assert (!mData->mHostDrive.isNull());
+            Assert (!m->hostDrive.isNull());
 
             Bstr name;
-            HRESULT  rc = mData->mHostDrive->COMGETTER(Name) (name.asOutParam());
+            HRESULT  rc = m->hostDrive->COMGETTER(Name) (name.asOutParam());
             AssertComRC (rc);
             Assert (!name.isEmpty());
@@ -531,5 +544,5 @@
             break;
         default:
-            ComAssertMsgFailedRet (("Invalid drive state: %d", mData->mState),
+            ComAssertMsgFailedRet (("Invalid drive state: %d", m->state),
                                     E_FAIL);
     }
@@ -547,27 +560,38 @@
     AssertComRCReturn (autoCaller.rc(), false);
 
+    /* we need adep for the state check */
+    Machine::AutoAnyStateDependency adep (mParent);
+    AssertComRCReturn (adep.rc(), false);
+
     AutoWriteLock alock (this);
 
     bool changed = false;
 
-    if (mData.isBackedUp())
+    if (m.isBackedUp())
     {
         /* we need to check all data to see whether anything will be changed
          * after rollback */
-        changed = mData.hasActualChanges();
+        changed = m.hasActualChanges();
 
         if (changed)
         {
-            Data *oldData = mData.backedUpData();
-
-            if (!mData->mImage.isNull() &&
-                !oldData->mImage.equalsTo (mData->mImage))
+            Data *oldData = m.backedUpData();
+
+            if (!m->image.isNull() &&
+                !oldData->image.equalsTo (m->image))
             {
                 /* detach the current image that will go away after rollback */
-                mData->mImage->detachFrom (mParent->id(), mParent->snapshotId());
+                m->image->detachFrom (mParent->id(), mParent->snapshotId());
+
+                /* unlock the image for reading if the VM is online */
+                if (Global::IsOnline (adep.machineState()))
+                {
+                    HRESULT rc = m->image->UnlockRead (NULL);
+                    AssertComRC (rc);
+                }
             }
         }
 
-        mData.rollback();
+        m.rollback();
     }
 
@@ -589,24 +613,35 @@
     AssertComRCReturnVoid (peerCaller.rc());
 
+    /* we need adep for the state check */
+    Machine::AutoAnyStateDependency adep (mParent);
+    AssertComRCReturnVoid (adep.rc());
+
     /* lock both for writing since we modify both (mPeer is "master" so locked
      * first) */
     AutoMultiWriteLock2 alock (mPeer, this);
 
-    if (mData.isBackedUp())
-    {
-        Data *oldData = mData.backedUpData();
-
-        if (!oldData->mImage.isNull() &&
-            !oldData->mImage.equalsTo (mData->mImage))
+    if (m.isBackedUp())
+    {
+        Data *oldData = m.backedUpData();
+
+        if (!oldData->image.isNull() &&
+            !oldData->image.equalsTo (m->image))
         {
             /* detach the old image that will go away after commit */
-            oldData->mImage->detachFrom (mParent->id(), mParent->snapshotId());
-        }
-
-        mData.commit();
+            oldData->image->detachFrom (mParent->id(), mParent->snapshotId());
+
+            /* unlock the image for reading if the VM is online */
+            if (Global::IsOnline (adep.machineState()))
+            {
+                HRESULT rc = oldData->image->UnlockRead (NULL);
+                AssertComRC (rc);
+            }
+        }
+
+        m.commit();
         if (mPeer)
         {
             /* attach new data to the peer and reshare it */
-            mPeer->mData.attach (mData);
+            mPeer->m.attach (m);
         }
     }
@@ -632,5 +667,5 @@
 
     /* this will back up current data */
-    mData.assignCopy (aThat->mData);
+    m.assignCopy (aThat->m);
 }
 
@@ -644,12 +679,12 @@
     AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
 
-    mData.backup();
-
-    if (mData->mImage)
-        mData->mImage.setNull();
-    if (mData->mHostDrive)
-        mData->mHostDrive.setNull();
-
-    mData->mState = DriveState_NotMounted;
+    m.backup();
+
+    if (m->image)
+        m->image.setNull();
+    if (m->hostDrive)
+        m->hostDrive.setNull();
+
+    m->state = DriveState_NotMounted;
 
     return S_OK;
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 15990)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 15991)
@@ -10428,7 +10428,7 @@
         {
             AutoReadLock driveLock (mDVDDrive);
-            if (mDVDDrive->data()->mState == DriveState_ImageMounted)
+            if (mDVDDrive->data()->state == DriveState_ImageMounted)
             {
-                rc = mDVDDrive->data()->mImage->UnlockRead (NULL);
+                rc = mDVDDrive->data()->image->UnlockRead (NULL);
                 AssertComRC (rc);
             }
@@ -10436,7 +10436,7 @@
         {
             AutoReadLock driveLock (mFloppyDrive);
-            if (mFloppyDrive->data()->mState == DriveState_ImageMounted)
+            if (mFloppyDrive->data()->state == DriveState_ImageMounted)
             {
-                rc = mFloppyDrive->data()->mImage->UnlockRead (NULL);
+                rc = mFloppyDrive->data()->image->UnlockRead (NULL);
                 AssertComRC (rc);
             }
Index: /trunk/src/VBox/Main/include/DVDDriveImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/DVDDriveImpl.h	(revision 15990)
+++ /trunk/src/VBox/Main/include/DVDDriveImpl.h	(revision 15991)
@@ -43,6 +43,6 @@
         Data()
         {
-            mState = DriveState_NotMounted;
-            mPassthrough = false;
+            state = DriveState_NotMounted;
+            passthrough = false;
         }
 
@@ -50,13 +50,13 @@
         {
             return this == &that ||
-                   (mState == that.mState &&
-                    mImage.equalsTo (that.mImage) &&
-                    mHostDrive.equalsTo (that.mHostDrive));
+                   (state == that.state &&
+                    image.equalsTo (that.image) &&
+                    hostDrive.equalsTo (that.hostDrive));
         }
 
-        ComObjPtr <DVDImage2> mImage;
-        ComPtr <IHostDVDDrive> mHostDrive;
-        DriveState_T mState;
-        BOOL mPassthrough;
+        ComObjPtr <DVDImage2> image;
+        ComPtr <IHostDVDDrive> hostDrive;
+        DriveState_T state;
+        BOOL passthrough;
     };
 
@@ -102,6 +102,6 @@
     HRESULT saveSettings (settings::Key &aMachineNode);
 
-    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
-    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
+    bool isModified() { AutoWriteLock alock (this); return m.isBackedUp(); }
+    bool isReallyModified() { AutoWriteLock alock (this); return m.hasActualChanges(); }
     bool rollback();
     void commit();
@@ -113,5 +113,5 @@
     // (ensure there is a caller and a read lock before calling them!)
 
-    Backupable <Data> &data() { return mData; }
+    Backupable <Data> &data() { return m; }
 
     // for VirtualBoxSupportErrorInfoImpl
@@ -123,5 +123,5 @@
     const ComObjPtr <DVDDrive> mPeer;
 
-    Backupable <Data> mData;
+    Backupable <Data> m;
 };
 
Index: /trunk/src/VBox/Main/include/FloppyDriveImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/FloppyDriveImpl.h	(revision 15990)
+++ /trunk/src/VBox/Main/include/FloppyDriveImpl.h	(revision 15991)
@@ -43,6 +43,6 @@
         Data()
         {
-            mEnabled    = true;
-            mState = DriveState_NotMounted;
+            enabled = true;
+            state = DriveState_NotMounted;
         }
 
@@ -50,13 +50,13 @@
         {
             return this == &that ||
-                   (mState == that.mState &&
-                    mImage.equalsTo (that.mImage) &&
-                    mHostDrive.equalsTo (that.mHostDrive));
+                   (state == that.state &&
+                    image.equalsTo (that.image) &&
+                    hostDrive.equalsTo (that.hostDrive));
         }
 
-        BOOL mEnabled;
-        ComObjPtr <FloppyImage2> mImage;
-        ComPtr <IHostFloppyDrive> mHostDrive;
-        DriveState_T mState;
+        BOOL enabled;
+        ComObjPtr <FloppyImage2> image;
+        ComPtr <IHostFloppyDrive> hostDrive;
+        DriveState_T state;
     };
 
@@ -102,6 +102,6 @@
     HRESULT saveSettings (settings::Key &aMachineNode);
 
-    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
-    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
+    bool isModified() { AutoWriteLock alock (this); return m.isBackedUp(); }
+    bool isReallyModified() { AutoWriteLock alock (this); return m.hasActualChanges(); }
     bool rollback();
     void commit();
@@ -113,5 +113,5 @@
     // (ensure there is a caller and a read lock before calling them!)
 
-    Backupable <Data> &data() { return mData; }
+    Backupable <Data> &data() { return m; }
 
     // for VirtualBoxSupportErrorInfoImpl
@@ -123,5 +123,5 @@
     const ComObjPtr <FloppyDrive> mPeer;
 
-    Backupable <Data> mData;
+    Backupable <Data> m;
 };
 
