VirtualBox

Changeset 49647 in vbox


Ignore:
Timestamp:
Nov 25, 2013 6:48:56 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Medium enumeration mechanism: Full update for every (cached and actual) medium related to particular VM on snapshot delete operation.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/medium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r49646 r49647  
    7171    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltHandleMachineUpdate(QString)));
    7272    connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltHandleMachineUpdate(QString)));
    73     connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltHandleMachineUpdate(QString)));
     73    connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltHandleSnapshotDeleted(QString, QString)));
    7474    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltHandleMachineUpdate(QString)));
    7575    connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), this, SLOT(sltHandleMachineRegistration(QString, bool)));
     
    177177    /* Gather previously used UIMedium IDs: */
    178178    QStringList previousUIMediumIDs;
    179     calculateCachedUsage(strMachineID, previousUIMediumIDs, true);
     179    calculateCachedUsage(strMachineID, previousUIMediumIDs, true /* take into account current state only */);
    180180    LogRel(("UIMediumEnumerator:  Old usage: %s\n",
    181181            previousUIMediumIDs.isEmpty() ? "<empty>" : previousUIMediumIDs.join(", ").toAscii().constData()));
     
    243243            fRegistered ? "registration" : "unregistration",
    244244            strMachineID.toAscii().constData()));
     245}
     246
     247void UIMediumEnumerator::sltHandleSnapshotDeleted(QString strMachineID, QString strSnapshotID)
     248{
     249    LogRel(("UIMediumEnumerator: Snapshot-deleted event received, Machine ID = {%s}, Snapshot ID = {%s}\n",
     250            strMachineID.toAscii().constData(), strSnapshotID.toAscii().constData()));
     251
     252    /* Gather previously used UIMedium IDs: */
     253    QStringList previousUIMediumIDs;
     254    calculateCachedUsage(strMachineID, previousUIMediumIDs, false /* take into account current state only */);
     255    LogRel(("UIMediumEnumerator:  Old usage: %s\n",
     256            previousUIMediumIDs.isEmpty() ? "<empty>" : previousUIMediumIDs.join(", ").toAscii().constData()));
     257
     258    /* Gather currently used CMediums and their IDs: */
     259    CMediumMap currentCMediums;
     260    QStringList currentCMediumIDs;
     261    calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs);
     262    LogRel(("UIMediumEnumerator:  New usage: %s\n",
     263            currentCMediumIDs.isEmpty() ? "<empty>" : currentCMediumIDs.join(", ").toAscii().constData()));
     264
     265    /* Update everything: */
     266    recacheFromCachedUsage(previousUIMediumIDs);
     267    recacheFromActualUsage(currentCMediums, currentCMediumIDs);
     268
     269    LogRel(("UIMediumEnumerator: Snapshot-deleted event processed, Machine ID = {%s}, Snapshot ID = {%s}\n",
     270            strMachineID.toAscii().constData(), strSnapshotID.toAscii().constData()));
    245271}
    246272
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r49646 r49647  
    7070    /** Handles machine-[un]registration events. */
    7171    void sltHandleMachineRegistration(QString strMachineID, bool fRegistered);
     72    /** Handles snapshot-deleted events. */
     73    void sltHandleSnapshotDeleted(QString strMachineID, QString strSnapshotID);
    7274
    7375    /* Handler: Medium-enumeration stuff: */
Note: See TracChangeset for help on using the changeset viewer.

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