VirtualBox

Changeset 25907 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jan 18, 2010 7:12:45 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56723
Message:

Main: fix regression from today that media registry was not saved during restoreSnapshot()

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MediumImpl.cpp

    r25903 r25907  
    41304130    if (FAILED(rc)) return rc;
    41314131
    4132     ComObjPtr <Progress> progress;
     4132    ComObjPtr<Progress> progress;
    41334133
    41344134    if (aProgress != NULL)
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r25903 r25907  
    17601760        /* grab differencing hard disks from the old attachments that will
    17611761         * become unused and need to be auto-deleted */
    1762 
    17631762        std::list< ComObjPtr<MediumAttachment> > llDiffAttachmentsToDelete;
    17641763
     
    18011800
    18021801        // detach the current-state diffs that we detected above and build a list of
    1803         // images to delete _after_ saveSettings()
     1802        // image files to delete _after_ saveSettings()
    18041803
    18051804        MediaList llDiffsToDelete;
     
    18351834
    18361835        AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
    1837         if (fNeedsSaveSettings)
    1838             // VirtualBox.xml needs saving too: must not hold machine lock at this point!
    1839             mParent->saveSettings();
    1840 
    18411836        alock.enter();
    18421837
    1843         // save all settings, reset the modified flag and commit;
     1838        // save machine settings, reset the modified flag and commit;
    18441839        rc = saveSettings(SaveS_ResetCurStateModified | saveFlags);
    18451840        if (FAILED(rc)) throw rc;
     1841
     1842        // let go of the locks while we're deleting image files below
     1843        alock.leave();
     1844        vboxLock.release();
    18461845
    18471846        // from here on we cannot roll back on failure any more
     
    18541853            LogFlowThisFunc(("Deleting old current state in differencing image '%s'\n", pMedium->getName().raw()));
    18551854
    1856             HRESULT rc2 = pMedium->deleteStorageAndWait(NULL /*aProgress*/, NULL /*pfNeedsSaveSettings*/ );
     1855            HRESULT rc2 = pMedium->deleteStorageAndWait(NULL /*aProgress*/, &fNeedsSaveSettings);
    18571856            // ignore errors here because we cannot roll back after saveSettings() above
    18581857            if (SUCCEEDED(rc2))
    18591858                pMedium->uninit();
     1859        }
     1860
     1861        if (fNeedsSaveSettings)
     1862        {
     1863            // finally, VirtualBox.xml needs saving too
     1864            vboxLock.acquire();
     1865            mParent->saveSettings();
    18601866        }
    18611867    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette