diff options
Diffstat (limited to '')
-rw-r--r-- | src/VBox/Main/src-server/AudioAdapterImpl.cpp | 40 |
1 files changed, 34 insertions, 6 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. |