<html xmlns='http://www.w3.org/1999/xhtml'> <head><meta http-equiv='content-type' content='text/html;charset=utf-8'></head><body><div><div id="MailBelowDiv"></div><div style="word-wrap: break-word;"><div><br></div><div>Please ignore it, it needs more testing.</div><div><br></div><div><br></div>------------------------------------------------------------------<div><br></div></div>When ole has set the clipboard data, the clipboard manager may preempt<br>this data (by sending a WM_RENDERFORMAT message). At this point the<br>clipboard ownership may be occupied by the clipboard manager; resulting<br>in a failure to flush the ole clipboard.<br><br>Signed-off-by: Haoyang Chen <br>---<br> dlls/ole32/clipboard.c       |  2 ++<br> dlls/ole32/tests/clipboard.c | 10 ++++++++++<br> 2 files changed, 12 insertions(+)<br><br>diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c<br>index e61b3076883..ebc498d52e7 100644<br>--- a/dlls/ole32/clipboard.c<br>+++ b/dlls/ole32/clipboard.c<br>
 @@ -2261,6 +2261,7 @@ HRESULT WINAPI OleFlushClipboard(void)<br>   HRESULT hr;<br>   ole_clipbrd *clipbrd;<br>   HWND wnd;<br>+  MSG msg;<br> <br>   TRACE("()
");<br> <br>@@ -2273,6 +2274,7 @@ HRESULT WINAPI OleFlushClipboard(void)<br>    */<br>   if (!clipbrd->src_data) return S_OK;<br> <br>+  PeekMessageW(&msg, wnd, WM_RENDERFORMAT, WM_RENDERFORMAT, PM_REMOVE);<br>   if (!OpenClipboard(wnd)) return CLIPBRD_E_CANT_OPEN;<br> <br>   SendMessageW(wnd, WM_RENDERALLFORMATS, 0, 0);<br>diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c<br>index fd8f287680b..47700e7f3fd 100644<br>--- a/dlls/ole32/tests/clipboard.c<br>+++ b/dlls/ole32/tests/clipboard.c<br>@@ -1085,6 +1085,7 @@ static void test_set_clipboard_DRAWCLIPBOARD(void)<br>     HWND viewer;<br>     int ret;<br>     HANDLE thread;<br>+    int i;<br> <br>     hr = DataObjectImpl_CreateText("data", &data);<br>     ok(hr == S_OK, "Failed to create data object: 0x%08x
", hr);<br>@@ -1120,6 +1121,15 @@ static void test_set_clipboard_DRAWCLIPBOARD(void)<br>     ret = SendMessageA( viewer, WM_USER, 0, 0 );<br>     ok( ret == 2, "%u WM_DRAWCLIPBOARD received
", ret );<br> <br>+    Sleep(500);<br>+<br>+    for (i = 0; i < 10; i++)<br>+    {<br>+        hr = OleFlushClipboard();<br>+        if (hr == S_OK) break;<br>+        Sleep(100);<br>+    }<br>+    ok(hr == S_OK, "got %08x
", hr);<br>     clip_data = NULL;<br>     hr = OleFlushClipboard();<br>     ok(hr == S_OK, "failed to flush clipboard, hr = 0x%08x
", hr);<br>-- <br>2.20.1<br><br><br><br><br></div></body></html>