diff options
author | Felix Geyer <debfx-pkg@fobos.de> | 2011-10-17 14:18:31 +0200 |
---|---|---|
committer | Felix Geyer <debfx-pkg@fobos.de> | 2011-10-17 14:18:31 +0200 |
commit | 1cf00a61132b69bc7e27254fdd74bf105d2da28c (patch) | |
tree | a7d314cc5ec77b4ce3e1f037af600b53ae1d43f8 /src/VBox/Main/src-server/MediumAttachmentImpl.cpp | |
parent | f8fd93b0b6b13ba94584bb61c1efd1a761f438c9 (diff) | |
download | virtualbox-1cf00a61132b69bc7e27254fdd74bf105d2da28c.tar.gz |
Imported Upstream version 4.1.4-dfsgupstream/4.1.4-dfsg
Diffstat (limited to 'src/VBox/Main/src-server/MediumAttachmentImpl.cpp')
-rw-r--r-- | src/VBox/Main/src-server/MediumAttachmentImpl.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/VBox/Main/src-server/MediumAttachmentImpl.cpp b/src/VBox/Main/src-server/MediumAttachmentImpl.cpp index 8fb9ab84b..0ad663de4 100644 --- a/src/VBox/Main/src-server/MediumAttachmentImpl.cpp +++ b/src/VBox/Main/src-server/MediumAttachmentImpl.cpp @@ -64,8 +64,8 @@ struct BackupableMediumAttachmentData struct MediumAttachment::Data { - Data() - : pMachine(NULL), + Data(Machine * const aMachine = NULL) + : pMachine(aMachine), fIsEjected(false) { } @@ -165,6 +165,36 @@ HRESULT MediumAttachment::init(Machine *aParent, } /** + * Initializes the medium attachment object given another guest object + * (a kind of copy constructor). This object makes a private copy of data + * of the original object passed as an argument. + */ +HRESULT MediumAttachment::initCopy(Machine *aParent, MediumAttachment *aThat) +{ + LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); + + ComAssertRet(aParent && aThat, E_INVALIDARG); + + /* Enclose the state transition NotReady->InInit->Ready */ + AutoInitSpan autoInitSpan(this); + AssertReturn(autoInitSpan.isOk(), E_FAIL); + + m = new Data(aParent); + /* m->pPeer is left null */ + + AutoCaller thatCaller(aThat); + AssertComRCReturnRC(thatCaller.rc()); + + AutoReadLock thatlock(aThat COMMA_LOCKVAL_SRC_POS); + m->bd.attachCopy(aThat->m->bd); + + /* Confirm a successful initialization */ + autoInitSpan.setSucceeded(); + + return S_OK; +} + +/** * Uninitializes the instance. * Called from FinalRelease(). */ |