[Spice-devel] [PATCH] dcc: do not cause problem with multiple threads.

Frediano Ziglio fziglio at redhat.com
Thu Dec 10 12:13:59 PST 2015


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;
-- 
2.4.3



More information about the Spice-devel mailing list