[Spice-devel] [PATCH] dcc: do not cause problem with multiple threads.
Jonathon Jongsma
jjongsma at redhat.com
Fri Dec 11 06:46:15 PST 2015
On Thu, 2015-12-10 at 20:13 +0000, Frediano Ziglio wrote:
> With multiple cards configured you can have multiple workers running in
> different thread.
> With such configuration static variables not syncronized could lead
> to undefined behavior.
> ---
> server/dcc-send.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/server/dcc-send.c b/server/dcc-send.c
> index 30303e7..c29fd8c 100644
> --- a/server/dcc-send.c
> +++ b/server/dcc-send.c
> @@ -683,8 +683,8 @@ static void
> red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
> SpiceRect
> *first_area)
> {
> /* TODO: can't have those statics with multiple clients */
> - static int resent_surface_ids[MAX_PIPE_SIZE];
> - static SpiceRect resent_areas[MAX_PIPE_SIZE]; // not pointers since
> drawbales may be released
> + int resent_surface_ids[MAX_PIPE_SIZE];
> + SpiceRect resent_areas[MAX_PIPE_SIZE]; // not pointers since drawbales
> may be released
> int num_resent;
> PipeItem *pipe_item;
> Ring *pipe;
I can't figure out why those variables would have been defined static in the
first place... The patch looks correct to me. Perhaps you could fix the comment
typo at the same time though: drawbales -> drawables
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
More information about the Spice-devel
mailing list