coverity#1371312 Missing move assignment operator

Change-Id: I4484f270e33e479c954c8421a46d52f3d81ec4dc
This commit is contained in:
Caolán McNamara
2016-11-11 10:11:25 +00:00
parent 0854e1a6f9
commit d3c751fe21
2 changed files with 34 additions and 3 deletions

View File

@@ -283,10 +283,12 @@ public:
TransferableDataHelper();
TransferableDataHelper( const TransferableDataHelper& rDataHelper );
TransferableDataHelper( TransferableDataHelper&& rDataHelper );
TransferableDataHelper( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable );
~TransferableDataHelper();
TransferableDataHelper& operator=( const TransferableDataHelper& rDataHelper );
TransferableDataHelper& operator=( TransferableDataHelper&& rDataHelper );
const css::uno::Reference< css::datatransfer::XTransferable >& GetTransferable() const { return mxTransfer; }
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const;

View File

@@ -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( );