Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b7a2e83d
Commit
b7a2e83d
authored
Mar 26, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Mar 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: OleFlushClipboard shouldn't call EmptyClipboard.
parent
524a99a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
32 deletions
+26
-32
clipboard.c
dlls/ole32/clipboard.c
+4
-32
clipboard.c
dlls/ole32/tests/clipboard.c
+22
-0
No files found.
dlls/ole32/clipboard.c
View file @
b7a2e83d
...
...
@@ -1474,13 +1474,9 @@ HRESULT WINAPI OleFlushClipboard(void)
FORMATETC
rgelt
;
HRESULT
hr
=
S_OK
;
BOOL
bClipboardOpen
=
FALSE
;
IDataObject
*
pIDataObjectSrc
=
NULL
;
TRACE
(
"()
\n
"
);
/*
* Make sure we have a clipboard object
*/
OLEClipbrd_Initialize
();
/*
...
...
@@ -1489,30 +1485,14 @@ HRESULT WINAPI OleFlushClipboard(void)
if
(
!
theOleClipboard
->
pIDataObjectSrc
)
return
S_OK
;
/*
* Addref and save the source data object we are holding on to temporarily,
* since it will be released when we empty the clipboard.
*/
pIDataObjectSrc
=
theOleClipboard
->
pIDataObjectSrc
;
IDataObject_AddRef
(
pIDataObjectSrc
);
/*
* Open the Windows clipboard
*/
if
(
!
(
bClipboardOpen
=
OpenClipboard
(
theOleClipboard
->
hWndClipboard
))
)
HANDLE_ERROR
(
CLIPBRD_E_CANT_OPEN
);
/*
* Empty the current clipboard
*/
if
(
!
EmptyClipboard
()
)
HANDLE_ERROR
(
CLIPBRD_E_CANT_EMPTY
);
/*
* Render all HGLOBAL formats supported by the source into
* the windows clipboard.
*/
if
(
FAILED
(
hr
=
IDataObject_EnumFormatEtc
(
pIDataObjectSrc
,
if
(
FAILED
(
hr
=
IDataObject_EnumFormatEtc
(
theOleClipboard
->
pIDataObjectSrc
,
DATADIR_GET
,
&
penumFormatetc
)
))
{
...
...
@@ -1528,10 +1508,7 @@ HRESULT WINAPI OleFlushClipboard(void)
GetClipboardFormatNameA
(
rgelt
.
cfFormat
,
szFmtName
,
sizeof
(
szFmtName
)
-
1
)
?
szFmtName
:
""
);
/*
* Render the clipboard data
*/
if
(
FAILED
(
OLEClipbrd_RenderFormat
(
pIDataObjectSrc
,
&
rgelt
))
)
if
(
FAILED
(
OLEClipbrd_RenderFormat
(
theOleClipboard
->
pIDataObjectSrc
,
&
rgelt
))
)
continue
;
}
}
...
...
@@ -1540,16 +1517,11 @@ HRESULT WINAPI OleFlushClipboard(void)
hr
=
set_dataobject_format
(
NULL
);
/*
* Release the source data object we are holding on to
*/
IDataObject_Release
(
pIDataObjectSrc
);
IDataObject_Release
(
theOleClipboard
->
pIDataObjectSrc
);
theOleClipboard
->
pIDataObjectSrc
=
NULL
;
CLEANUP:
/*
* Close Windows clipboard (It remains associated with our window)
*/
if
(
bClipboardOpen
&&
!
CloseClipboard
()
)
hr
=
CLIPBRD_E_CANT_CLOSE
;
...
...
dlls/ole32/tests/clipboard.c
View file @
b7a2e83d
...
...
@@ -625,6 +625,7 @@ static void test_set_clipboard(void)
HRESULT
hr
;
ULONG
ref
;
LPDATAOBJECT
data1
,
data2
,
data_cmpl
;
HGLOBAL
hblob
,
h
;
cf_stream
=
RegisterClipboardFormatA
(
"stream format"
);
cf_storage
=
RegisterClipboardFormatA
(
"storage format"
);
...
...
@@ -681,6 +682,16 @@ static void test_set_clipboard(void)
hr
=
OleIsCurrentClipboard
(
NULL
);
ok
(
hr
==
S_FALSE
,
"expect S_FALSE, hr = 0x%08x
\n
"
,
hr
);
/* put a format directly onto the clipboard to show
OleFlushClipboard doesn't empty the clipboard */
hblob
=
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
|
GMEM_ZEROINIT
,
10
);
OpenClipboard
(
NULL
);
h
=
SetClipboardData
(
cf_onemore
,
hblob
);
ok
(
h
==
hblob
,
"got %p
\n
"
,
h
);
h
=
GetClipboardData
(
cf_onemore
);
ok
(
h
==
hblob
,
"got %p
\n
"
,
h
);
CloseClipboard
();
hr
=
OleFlushClipboard
();
ok
(
hr
==
S_OK
,
"failed to flush clipboard, hr = 0x%08x
\n
"
,
hr
);
hr
=
OleIsCurrentClipboard
(
data1
);
...
...
@@ -690,10 +701,21 @@ static void test_set_clipboard(void)
hr
=
OleIsCurrentClipboard
(
NULL
);
ok
(
hr
==
S_FALSE
,
"expect S_FALSE, hr = 0x%08x
\n
"
,
hr
);
/* format should survive the flush */
OpenClipboard
(
NULL
);
h
=
GetClipboardData
(
cf_onemore
);
ok
(
h
==
hblob
,
"got %p
\n
"
,
h
);
CloseClipboard
();
test_cf_dataobject
(
NULL
);
ok
(
OleSetClipboard
(
NULL
)
==
S_OK
,
"failed to clear clipboard, hr = 0x%08x
\n
"
,
hr
);
OpenClipboard
(
NULL
);
h
=
GetClipboardData
(
cf_onemore
);
ok
(
h
==
NULL
,
"got %p
\n
"
,
h
);
CloseClipboard
();
hr
=
OleSetClipboard
(
data_cmpl
);
ok
(
hr
==
S_OK
,
"failed to set clipboard to complex data, hr = 0x%08x
\n
"
,
hr
);
test_cf_dataobject
(
data_cmpl
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment