diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:46 +0000 |
commit | 96647a898d62d699808316238dfb933d960413f2 (patch) | |
tree | 0138491ada40b7b3fcb80d4b219fa7922ae8f512 /src/VBox/Main/src-server | |
parent | Adding debian version 7.0.14-dfsg-4. (diff) | |
download | virtualbox-96647a898d62d699808316238dfb933d960413f2.tar.xz virtualbox-96647a898d62d699808316238dfb933d960413f2.zip |
Merging upstream version 7.0.16-dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Main/src-server')
-rw-r--r-- | src/VBox/Main/src-server/AudioAdapterImpl.cpp | 40 | ||||
-rw-r--r-- | src/VBox/Main/src-server/AudioSettingsImpl.cpp | 14 |
2 files changed, 46 insertions, 8 deletions
diff --git a/src/VBox/Main/src-server/AudioAdapterImpl.cpp b/src/VBox/Main/src-server/AudioAdapterImpl.cpp index 66e40c6e..5c388771 100644 --- a/src/VBox/Main/src-server/AudioAdapterImpl.cpp +++ b/src/VBox/Main/src-server/AudioAdapterImpl.cpp @@ -233,6 +233,10 @@ HRESULT AudioAdapter::setEnabled(BOOL aEnabled) AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (m->bd->fEnabled != RT_BOOL(aEnabled)) @@ -241,7 +245,7 @@ HRESULT AudioAdapter::setEnabled(BOOL aEnabled) m->bd->fEnabled = RT_BOOL(aEnabled); alock.release(); - m->pParent->i_onSettingsChanged(); // mParent is const, needs no locking + m->pParent->i_onSettingsChanged(); // m->pParent is const, needs no locking m->pParent->i_onAdapterChanged(this); } @@ -265,6 +269,10 @@ HRESULT AudioAdapter::setEnabledIn(BOOL aEnabled) AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableOrSavedOrRunningStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (RT_BOOL(aEnabled) != m->bd->fEnabledIn) @@ -274,7 +282,7 @@ HRESULT AudioAdapter::setEnabledIn(BOOL aEnabled) alock.release(); - m->pParent->i_onSettingsChanged(); // mParent is const, needs no locking + m->pParent->i_onSettingsChanged(); // m->pParent is const, needs no locking m->pParent->i_onAdapterChanged(this); } @@ -298,6 +306,10 @@ HRESULT AudioAdapter::setEnabledOut(BOOL aEnabled) AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableOrSavedOrRunningStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (RT_BOOL(aEnabled) != m->bd->fEnabledOut) @@ -307,7 +319,7 @@ HRESULT AudioAdapter::setEnabledOut(BOOL aEnabled) alock.release(); - m->pParent->i_onSettingsChanged(); // mParent is const, needs no locking + m->pParent->i_onSettingsChanged(); // m->pParent is const, needs no locking m->pParent->i_onAdapterChanged(this); } @@ -331,6 +343,10 @@ HRESULT AudioAdapter::setAudioDriver(AudioDriverType_T aAudioDriver) AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableOrSavedStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); HRESULT hrc = S_OK; @@ -344,7 +360,7 @@ HRESULT AudioAdapter::setAudioDriver(AudioDriverType_T aAudioDriver) alock.release(); - m->pParent->i_onSettingsChanged(); // mParent is const, needs no locking + m->pParent->i_onSettingsChanged(); // m->pParent is const, needs no locking } else { @@ -373,6 +389,10 @@ HRESULT AudioAdapter::setAudioController(AudioControllerType_T aAudioController) AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); HRESULT hrc = S_OK; @@ -411,7 +431,7 @@ HRESULT AudioAdapter::setAudioController(AudioControllerType_T aAudioController) alock.release(); - m->pParent->i_onSettingsChanged(); // mParent is const, needs no locking + m->pParent->i_onSettingsChanged(); // m->pParent is const, needs no locking } } @@ -435,6 +455,10 @@ HRESULT AudioAdapter::setAudioCodec(AudioCodecType_T aAudioCodec) AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); HRESULT hrc = S_OK; @@ -484,7 +508,7 @@ HRESULT AudioAdapter::setAudioCodec(AudioCodecType_T aAudioCodec) alock.release(); - m->pParent->i_onSettingsChanged(); // mParent is const, needs no locking + m->pParent->i_onSettingsChanged(); // m->pParent is const, needs no locking } return hrc; @@ -530,6 +554,10 @@ HRESULT AudioAdapter::setProperty(const com::Utf8Str &aKey, const com::Utf8Str & AutoCaller autoCaller(this); if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); + /* the machine needs to be mutable */ + AutoMutableStateDependency adep(m->pParent->i_getMachine()); + if (FAILED(adep.hrc())) return adep.hrc(); + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Generic properties processing. diff --git a/src/VBox/Main/src-server/AudioSettingsImpl.cpp b/src/VBox/Main/src-server/AudioSettingsImpl.cpp index b7736f1f..851fea77 100644 --- a/src/VBox/Main/src-server/AudioSettingsImpl.cpp +++ b/src/VBox/Main/src-server/AudioSettingsImpl.cpp @@ -247,6 +247,16 @@ bool AudioSettings::i_canChangeSettings(void) } /** + * Returns a (weak) pointer of the audio setting's machine object. + * + * @returns Wweak pointer of the audio setting's machine object. + */ +Machine *AudioSettings::i_getMachine(void) +{ + return m->pMachine; // m->pMachine is const, needs no locking +} + +/** * Gets called when the machine object needs to know that audio adapter settings * have been changed. * @@ -255,7 +265,7 @@ bool AudioSettings::i_canChangeSettings(void) void AudioSettings::i_onAdapterChanged(IAudioAdapter *pAdapter) { AssertPtrReturnVoid(pAdapter); - m->pMachine->i_onAudioAdapterChange(pAdapter); // mParent is const, needs no locking + m->pMachine->i_onAudioAdapterChange(pAdapter); // m->pMachine is const, needs no locking } /** @@ -271,7 +281,7 @@ void AudioSettings::i_onHostDeviceChanged(IHostAudioDevice *pDevice, bool fIsNew, AudioDeviceState_T enmState, IVirtualBoxErrorInfo *pErrInfo) { AssertPtrReturnVoid(pDevice); - m->pMachine->i_onHostAudioDeviceChange(pDevice, fIsNew, enmState, pErrInfo); // mParent is const, needs no locking + m->pMachine->i_onHostAudioDeviceChange(pDevice, fIsNew, enmState, pErrInfo); // m->pMachine is const, needs no locking } /** |