VirtualBox

Ignore:
Timestamp:
May 8, 2015 7:31:25 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100156
Message:

FE/Qt: Settings dialog: Fixing serialization flaw due to which session unlocked event can be missed.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r55655 r55742  
    6363    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
    6464    , m_fPolished(false)
    65     /* Loading/saving stuff: */
     65    /* Serialization stuff: */
    6666    , m_pSerializeProcess(0)
    67     , m_fLoaded(false)
    68     , m_fSaved(false)
     67    , m_fSerializationIsInProgress(false)
    6968    /* Status-bar stuff: */
    7069    , m_pStatusBar(0)
     
    220219    }
    221220
    222     /* Mark as loaded: */
    223     m_fLoaded = true;
     221    /* Mark serialization finished: */
     222    m_fSerializationIsInProgress = false;
    224223}
    225224
     
    233232    }
    234233
    235     /* Mark as saved: */
    236     m_fSaved = true;
     234    /* Mark serialization finished: */
     235    m_fSerializationIsInProgress = false;
    237236}
    238237
     
    257256void UISettingsDialog::loadData(QVariant &data)
    258257{
    259     /* Mark as not loaded: */
    260     m_fLoaded = false;
     258    /* Mark serialization started: */
     259    m_fSerializationIsInProgress = true;
    261260
    262261    /* Create settings loader: */
     
    283282void UISettingsDialog::saveData(QVariant &data)
    284283{
    285     /* Mark as not saved: */
    286     m_fSaved = false;
     284    /* Mark serialization started: */
     285    m_fSerializationIsInProgress = true;
    287286
    288287    /* Create the 'settings saver': */
     
    531530void UISettingsDialog::reject()
    532531{
    533     if (m_fLoaded)
     532    if (!isSerializationInProgress())
    534533        QIMainDialog::reject();
    535534}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r55655 r55742  
    7373    /** Returns the serialize process instance. */
    7474    UISettingsSerializer* serializeProcess() const { return m_pSerializeProcess; }
     75    /** Returns whether the serialization is in progress. */
     76    bool isSerializationInProgress() const { return m_fSerializationIsInProgress; }
    7577
    7678    /** Loads the @a data. */
     
    143145    /** Holds the serialize process instance. */
    144146    UISettingsSerializer *m_pSerializeProcess;
    145 
    146     /* Loading/saving stuff: */
    147     bool m_fLoaded;
    148     bool m_fSaved;
     147    /** Holds whether the serialization is in progress. */
     148    bool m_fSerializationIsInProgress;
    149149
    150150    /* Status bar widget: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r55515 r55742  
    332332    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltAllowResetFirstRunFlag()));
    333333
     334    /* Make sure settings window will be updated on session/machine state/data changes: */
     335    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)),
     336            this, SLOT(sltSessionStateChanged(QString, KSessionState)));
     337    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
     338            this, SLOT(sltMachineStateChanged(QString, KMachineState)));
     339    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
     340            this, SLOT(sltMachineDataChanged(QString)));
     341
    334342    /* Get corresponding machine (required to determine dialog type and page availability): */
    335343    m_machine = vboxGlobal().virtualBox().FindMachine(m_strMachineId);
     
    500508        return;
    501509
    502     /* Disconnect global VBox events from this dialog: */
    503     gVBoxEvents->disconnect(this);
    504 
    505510    /* Prepare session: */
    506511    m_session = configurationAccessLevel() == ConfigurationAccessLevel_Null ? CSession() :
     
    528533    if (!m_session.isNull())
    529534        return;
    530 
    531     /* Disconnect global VBox events from this dialog: */
    532     gVBoxEvents->disconnect(this);
    533535
    534536    /* Prepare session: */
     
    735737        m_console = CConsole();
    736738    }
    737 
    738     /* Make sure settings window will be updated on machine state/data changes: */
    739     connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)),
    740             this, SLOT(sltSessionStateChanged(QString, KSessionState)));
    741     connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
    742             this, SLOT(sltMachineStateChanged(QString, KMachineState)));
    743     connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
    744             this, SLOT(sltMachineDataChanged(QString)));
    745739}
    746740
     
    762756void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSessionState sessionState)
    763757{
     758    /* Ignore if serialization is in progress: */
     759    if (isSerializationInProgress())
     760        return;
     761
    764762    /* Ignore if thats NOT our VM: */
    765763    if (strMachineId != m_strMachineId)
     
    779777void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState machineState)
    780778{
     779    /* Ignore if serialization is in progress: */
     780    if (isSerializationInProgress())
     781        return;
     782
    781783    /* Ignore if thats NOT our VM: */
    782784    if (strMachineId != m_strMachineId)
     
    796798void UISettingsDialogMachine::sltMachineDataChanged(QString strMachineId)
    797799{
     800    /* Ignore if serialization is in progress: */
     801    if (isSerializationInProgress())
     802        return;
     803
    798804    /* Ignore if thats NOT our VM: */
    799805    if (strMachineId != m_strMachineId)
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