VirtualBox

Changeset 95839 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 26, 2022 8:24:11 PM (2 years ago)
Author:
vboxsync
Message:

Recording/Main: Fixed a regression when loading settings < 1.19: There we use a bitmap instead of a count, so make sure to iterate by the number of configured monitors and use the bitmap for the monitor recording enabled status instead. bugref:9286

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r95835 r95839  
    60626062 * or \<Recording\> under \<Machine\>,
    60636063 */
    6064 void MachineConfigFile::readRecordingSettings(const xml::ElementNode &elmRecording, RecordingSettings &recording)
    6065 {
     6064void MachineConfigFile::readRecordingSettings(const xml::ElementNode &elmRecording, uint32_t cMonitors, RecordingSettings &recording)
     6065{
     6066    if (cMonitors > 64)
     6067        throw ConfigFileError(this, &elmRecording, N_("Invalid monitor count given"));
     6068
    60666069    elmRecording.getAttributeValue("enabled", recording.common.fEnabled);
    60676070
     
    60786081        if (cScreens != plstScreens.size())
    60796082            throw ConfigFileError(this, &elmRecording, N_("Recording/@screens attribute does not match stored screen objects"));
     6083        if (cScreens > 64)
     6084            throw ConfigFileError(this, &elmRecording, N_("Recording/@screens attribute is invalid"));
    60806085
    60816086        for (xml::ElementNodesList::iterator itScreen  = plstScreens.begin();
     
    61326137
    61336138        /* Convert the enabled screens to the former uint64_t bit array and vice versa. */
    6134         uint64_t cScreens = 0;
    6135         elmRecording.getAttributeValue("screens",   cScreens);
     6139        uint64_t uScreensBitmap = 0;
     6140        elmRecording.getAttributeValue("screens",   uScreensBitmap);
    61366141
    61376142        /* Note: For settings < 1.19 the "screens" attribute is a bit field for all screens
    61386143         *       which are ENABLED for recording. The settings for recording are for all the same though. */
    6139         for (unsigned i = 0; i <  cScreens; i++)
     6144        for (unsigned i = 0; i < cMonitors; i++)
    61406145        {
    61416146            /* Apply settings of screen 0 to screen i and enable it. */
    61426147            recording.mapScreens[i] = screen0;
    61436148
    6144             if (cScreens & RT_BIT_64(i)) /* Screen i enabled? */
     6149            if (uScreensBitmap & RT_BIT_64(i)) /* Screen i enabled? */
    61456150                recording.mapScreens[i].fEnabled = true;
    61466151        }
     
    62756280            const xml::ElementNode *pelmVideoCapture = pelmHardware->findChildElement("VideoCapture");
    62766281            if (pelmVideoCapture)
    6277                 readRecordingSettings(*pelmVideoCapture, pSnap->recordingSettings);
     6282                readRecordingSettings(*pelmVideoCapture, pSnap->hardware.graphicsAdapter.cMonitors, pSnap->recordingSettings);
    62786283        }
    62796284        else /* >= VBox 7.0 */
     
    62816286            const xml::ElementNode *pelmRecording = pElement->findChildElement("Recording");
    62826287            if (pelmRecording)
    6283                 readRecordingSettings(*pelmRecording, pSnap->recordingSettings);
     6288                readRecordingSettings(*pelmRecording, pSnap->hardware.graphicsAdapter.cMonitors, pSnap->recordingSettings);
    62846289        }
    62856290        // note: Groups exist only for Machine, not for Snapshot
     
    64766481                && m->sv <  SettingsVersion_v1_19
    64776482                && pelmMachineChild->nameEquals("VideoCapture"))   /* For settings >= 1.14 (< VBox 7.0). */
    6478                 readRecordingSettings(*pelmMachineChild, recordingSettings);
     6483                readRecordingSettings(*pelmMachineChild, hardwareMachine.graphicsAdapter.cMonitors, recordingSettings);
    64796484            else if (   m->sv >= SettingsVersion_v1_19
    64806485                     && pelmMachineChild->nameEquals("Recording")) /* Only exists for settings >= 1.19 (VBox 7.0). */
    6481                 readRecordingSettings(*pelmMachineChild, recordingSettings);
     6486                readRecordingSettings(*pelmMachineChild, hardwareMachine.graphicsAdapter.cMonitors, recordingSettings);
    64826487        }
    64836488
     
    81168121        return;
    81178122
     8123    AssertReturnVoid(recording.mapScreens.size() <= 64); /* Make sure we never exceed the bitmap of 64 monitors. */
     8124
    81188125    /* Note: Since settings 1.19 the recording settings have a dedicated XML branch outside of Hardware. */
    81198126    if (m->sv >= SettingsVersion_v1_19 /* VBox >= 7.0 */)
     
    81968203
    81978204        /* Convert the enabled screens to the former uint64_t bit array and vice versa. */
    8198         uint64_t u64VideoCaptureScreens = 0;
     8205        uint64_t uScreensBitmap = 0;
    81998206        RecordingScreenSettingsMap::const_iterator itScreen = recording.mapScreens.begin();
    82008207        while (itScreen != recording.mapScreens.end())
    82018208        {
    82028209            if (itScreen->second.fEnabled)
    8203                u64VideoCaptureScreens |= RT_BIT_64(itScreen->first);
     8210                uScreensBitmap |= RT_BIT_64(itScreen->first);
    82048211            ++itScreen;
    82058212        }
    82068213
    8207         if (u64VideoCaptureScreens)
    8208             pelmVideoCapture->setAttribute("screens",      u64VideoCaptureScreens);
     8214        if (uScreensBitmap)
     8215            pelmVideoCapture->setAttribute("screens",      uScreensBitmap);
    82098216
    82108217        Assert(recording.mapScreens.size());
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