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
ba7f6c54
Commit
ba7f6c54
authored
Oct 08, 2001
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 08, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix infinite loop problem in wineclipsrv startup.
LaunchServer: Don't give up on the first message. Added GetSelectionEvent: Limit CPU use and introduce timeout.
parent
671a2ee8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
13 deletions
+49
-13
clipboard.c
windows/x11drv/clipboard.c
+15
-1
wineclipsrv.c
windows/x11drv/wineclipsrv.c
+34
-12
No files found.
windows/x11drv/clipboard.c
View file @
ba7f6c54
...
@@ -295,10 +295,24 @@ BOOL X11DRV_CLIPBOARD_LaunchServer()
...
@@ -295,10 +295,24 @@ BOOL X11DRV_CLIPBOARD_LaunchServer()
else
else
{
{
/* Wait until we lose the selection, timing out after a minute */
/* Wait until we lose the selection, timing out after a minute */
DWORD
start_time
,
timeout
,
elapsed
,
ret
;
TRACE
(
"Waiting for clipboard server to acquire selection
\n
"
);
TRACE
(
"Waiting for clipboard server to acquire selection
\n
"
);
if
(
MsgWaitForMultipleObjects
(
1
,
&
selectionClearEvent
,
FALSE
,
60000
,
QS_ALLINPUT
)
!=
WAIT_OBJECT_0
)
timeout
=
60000
;
start_time
=
GetTickCount
();
elapsed
=
0
;
do
{
ret
=
MsgWaitForMultipleObjects
(
1
,
&
selectionClearEvent
,
FALSE
,
timeout
-
elapsed
,
QS_ALLINPUT
);
if
(
ret
!=
WAIT_OBJECT_0
+
1
)
break
;
elapsed
=
GetTickCount
()
-
start_time
;
if
(
elapsed
>
timeout
)
break
;
}
while
(
1
);
if
(
ret
!=
WAIT_OBJECT_0
)
TRACE
(
"Server could not acquire selection, or a timeout occurred!
\n
"
);
TRACE
(
"Server could not acquire selection, or a timeout occurred!
\n
"
);
else
else
TRACE
(
"Server successfully acquired selection
\n
"
);
TRACE
(
"Server successfully acquired selection
\n
"
);
...
...
windows/x11drv/wineclipsrv.c
View file @
ba7f6c54
...
@@ -415,6 +415,36 @@ int AcquireSelection()
...
@@ -415,6 +415,36 @@ int AcquireSelection()
return
g_selectionAcquired
;
return
g_selectionAcquired
;
}
}
BOOL
GetSelectionEvent
(
Atom
SelectionSrc
,
XEvent
*
xe
)
{
time_t
end_time
;
/* Set up a 10 second time out */
end_time
=
time
(
NULL
)
+
10
;
do
{
struct
timeval
nap
;
if
(
XCheckTypedWindowEvent
(
g_display
,
g_win
,
SelectionNotify
,
xe
))
{
if
(
xe
->
xselection
.
selection
==
SelectionSrc
)
return
TRUE
;
}
if
(
time
(
NULL
)
>
end_time
)
break
;
/* Sleep a bit to make this busy wait less brutal */
nap
.
tv_sec
=
0
;
nap
.
tv_usec
=
10
;
select
(
0
,
NULL
,
NULL
,
NULL
,
&
nap
);
}
while
(
TRUE
);
return
FALSE
;
}
/**************************************************************************
/**************************************************************************
* CacheDataFormats
* CacheDataFormats
*
*
...
@@ -457,12 +487,8 @@ int CacheDataFormats( Atom SelectionSrc, PCACHEENTRY *ppCache )
...
@@ -457,12 +487,8 @@ int CacheDataFormats( Atom SelectionSrc, PCACHEENTRY *ppCache )
/*
/*
* Wait until SelectionNotify is received
* Wait until SelectionNotify is received
*/
*/
while
(
TRUE
)
if
(
!
GetSelectionEvent
(
SelectionSrc
,
&
xe
))
{
return
0
;
if
(
XCheckTypedWindowEvent
(
g_display
,
g_win
,
SelectionNotify
,
&
xe
)
)
if
(
xe
.
xselection
.
selection
==
SelectionSrc
)
break
;
}
/* Verify that the selection returned a valid TARGETS property */
/* Verify that the selection returned a valid TARGETS property */
if
(
(
xe
.
xselection
.
target
!=
aTargets
)
if
(
(
xe
.
xselection
.
target
!=
aTargets
)
...
@@ -541,12 +567,8 @@ BOOL FillCacheEntry( Atom SelectionSrc, Atom target, PCACHEENTRY pCacheEntry )
...
@@ -541,12 +567,8 @@ BOOL FillCacheEntry( Atom SelectionSrc, Atom target, PCACHEENTRY pCacheEntry )
g_win
,
CurrentTime
);
g_win
,
CurrentTime
);
/* wait until SelectionNotify is received */
/* wait until SelectionNotify is received */
while
(
TRUE
)
if
(
!
GetSelectionEvent
(
SelectionSrc
,
&
xe
))
{
return
bRet
;
if
(
XCheckTypedWindowEvent
(
g_display
,
g_win
,
SelectionNotify
,
&
xe
)
)
if
(
xe
.
xselection
.
selection
==
SelectionSrc
)
break
;
}
/* Now proceed to retrieve the actual converted property from
/* Now proceed to retrieve the actual converted property from
* the SELECTION_DATA atom */
* the SELECTION_DATA atom */
...
...
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