diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-11 10:11:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-11 13:08:20 +0000 |
commit | d3c751fe21856cb0fcfe5672ebd9f40eaaf1dab4 (patch) | |
tree | df90ed7eca02fce38d2a11900c47185f66a250a3 /svtools/source/misc/transfer.cxx | |
parent | 0854e1a6f985b6cc272950dd3d2f3027e2f01080 (diff) |
coverity#1371312 Missing move assignment operator
Change-Id: I4484f270e33e479c954c8421a46d52f3d81ec4dc
Diffstat (limited to 'svtools/source/misc/transfer.cxx')
-rw-r--r-- | svtools/source/misc/transfer.cxx | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 5c0350feacd8..1f7fcb7ad3ff 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -1137,15 +1137,24 @@ TransferableDataHelper::TransferableDataHelper(const TransferableDataHelper& rDa { } +TransferableDataHelper::TransferableDataHelper(TransferableDataHelper&& rDataHelper) + : mxTransfer(std::move(rDataHelper.mxTransfer)) + , mxClipboard(std::move(rDataHelper.mxClipboard)) + , mxFormats(std::move(rDataHelper.mxFormats)) + , mxObjDesc(std::move(rDataHelper.mxObjDesc)) + , mxImpl(new TransferableDataHelper_Impl) +{ +} + TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDataHelper& rDataHelper ) { if ( this != &rDataHelper ) { ::osl::MutexGuard aGuard(mxImpl->maMutex); - bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener); + const bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener); - if ( bWasClipboardListening ) + if (bWasClipboardListening) StopClipboardListening(); mxTransfer = rDataHelper.mxTransfer; @@ -1153,13 +1162,33 @@ TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDat mxObjDesc.reset(new TransferableObjectDescriptor(*rDataHelper.mxObjDesc)); mxClipboard = rDataHelper.mxClipboard; - if ( bWasClipboardListening ) + if (bWasClipboardListening) StartClipboardListening(); } return *this; } +TransferableDataHelper& TransferableDataHelper::operator=(TransferableDataHelper&& rDataHelper) +{ + ::osl::MutexGuard aGuard(mxImpl->maMutex); + + const bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener); + + if (bWasClipboardListening) + StopClipboardListening(); + + mxTransfer = std::move(rDataHelper.mxTransfer); + mxFormats = std::move(rDataHelper.mxFormats); + mxObjDesc = std::move(rDataHelper.mxObjDesc); + mxClipboard = std::move(rDataHelper.mxClipboard); + + if (bWasClipboardListening) + StartClipboardListening(); + + return *this; +} + TransferableDataHelper::~TransferableDataHelper() { StopClipboardListening( ); |