summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-03-02 15:00:56 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-03-03 11:29:45 +0100
commitcf1c835e8016f8f1eefea6d625a913c0ac343a63 (patch)
tree4017bfcaa37ecdc8f1cbf1b55383c3bc4922c457 /vcl/win
parent9b56b718f6921b1160733e56f5cfc0d12c4146ab (diff)
tdf#116983 tdf#136175: retry if failed
Debugging the test case from the latter bug report shows that indeed the call to OleGetClipboard may fail first time, as jasonkres had suspected in the former bug. So follow the suggestion in tdf#116983, and retry the failing calls several times in case of failure. Many thanks to Telesto for preparing a clear bug report with reliable test case. Co-authored-by: jasonkres Change-Id: Ib3c497da830bc5faac586bcfe1eededa54bfa117 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111825 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/dtrans/MtaOleClipb.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx
index 3898bdc30dfb..00fbf4143386 100644
--- a/vcl/win/dtrans/MtaOleClipb.cxx
+++ b/vcl/win/dtrans/MtaOleClipb.cxx
@@ -44,6 +44,7 @@
#include <process.h>
#include <systools/win32/comtools.hxx>
+#include <systools/win32/retry_if_failed.hxx>
#include <comphelper/windowserrorstring.hxx>
@@ -465,7 +466,8 @@ bool CMtaOleClipboard::onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncCli
HRESULT CMtaOleClipboard::onSetClipboard( IDataObject* pIDataObject )
{
- return OleSetClipboard( pIDataObject );
+ return sal::systools::RetryIfFailed(10, 100,
+ [pIDataObject] { return OleSetClipboard(pIDataObject); });
}
HRESULT CMtaOleClipboard::onGetClipboard( LPSTREAM* ppStream )
@@ -475,7 +477,8 @@ HRESULT CMtaOleClipboard::onGetClipboard( LPSTREAM* ppStream )
IDataObjectPtr pIDataObject;
// forward the request to the OleClipboard
- HRESULT hr = OleGetClipboard( &pIDataObject );
+ HRESULT hr
+ = sal::systools::RetryIfFailed(10, 100, [p = &pIDataObject] { return OleGetClipboard(p); });
if ( SUCCEEDED( hr ) )
{
hr = MarshalIDataObjectInStream(pIDataObject.get(), ppStream);
@@ -488,7 +491,7 @@ HRESULT CMtaOleClipboard::onGetClipboard( LPSTREAM* ppStream )
HRESULT CMtaOleClipboard::onFlushClipboard( )
{
- return OleFlushClipboard();
+ return sal::systools::RetryIfFailed(10, 100, [] { return OleFlushClipboard(); });
}
// handle clipboard update event