Huw Davies : ole32: Don't set cf_dataobject if we're clearing the clipboard .

Alexandre Julliard julliard at winehq.org
Tue Apr 21 11:45:44 CDT 2009


Module: wine
Branch: master
Commit: 575b0e1435bd7f3069c879f143b524792a44472b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=575b0e1435bd7f3069c879f143b524792a44472b

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Apr 17 13:44:27 2009 +0100

ole32: Don't set cf_dataobject if we're clearing the clipboard.

---

 dlls/ole32/clipboard.c       |    3 ++-
 dlls/ole32/tests/clipboard.c |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 9397a14..c28b2f4 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -1729,7 +1729,8 @@ HRESULT WINAPI OleSetClipboard(IDataObject* data)
   hr = set_src_dataobject(clipbrd, data);
   if(FAILED(hr)) goto end;
 
-  hr = set_dataobject_format(wnd);
+  if(data)
+    hr = set_dataobject_format(wnd);
 
 end:
 
diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c
index 51b3a62..4e5f497 100644
--- a/dlls/ole32/tests/clipboard.c
+++ b/dlls/ole32/tests/clipboard.c
@@ -595,6 +595,21 @@ static void test_enum_fmtetc(IDataObject *src)
     IDataObject_Release(data);
 }
 
+static void test_no_cf_dataobject(void)
+{
+    UINT cf_dataobject = RegisterClipboardFormatA("DataObject");
+    UINT cf_ole_priv_data = RegisterClipboardFormatA("Ole Private Data");
+    HANDLE h;
+    OpenClipboard(NULL);
+
+    h = GetClipboardData(cf_dataobject);
+    ok(!h, "got %p\n", h);
+    h = GetClipboardData(cf_ole_priv_data);
+    ok(!h, "got %p\n", h);
+
+    CloseClipboard();
+}
+
 static void test_cf_dataobject(IDataObject *data)
 {
     UINT cf = 0;
@@ -851,6 +866,7 @@ static void test_set_clipboard(void)
 
     ok(OleSetClipboard(NULL) == S_OK, "failed to clear clipboard, hr = 0x%08x\n", hr);
 
+    test_no_cf_dataobject();
     test_enum_fmtetc(NULL);
 
     ref = IDataObject_Release(data1);




More information about the wine-cvs mailing list