summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2010-09-01 12:10:35 +0300
committerAlexander Larsson <alexl@redhat.com>2010-09-02 18:45:09 +0200
commit039700a90f5c2a0e0d3097e4feae3a84998e4111 (patch)
tree43f9051a27bb1e76f051e04b14e65808afb7d4f1
parent0c6d654c2f67795fe5c3229bb615ab2bd99ef7a4 (diff)
downloadspice-039700a90f5c2a0e0d3097e4feae3a84998e4111.tar.gz
spice-039700a90f5c2a0e0d3097e4feae3a84998e4111.tar.xz
spice-039700a90f5c2a0e0d3097e4feae3a84998e4111.zip
server: avoid creating a stream from traces more than once for the same drawable
could have caused ASSERT(!drawable->stream) in red_create_stream
-rw-r--r--server/red_worker.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 36c27636..74d26fec 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2732,7 +2732,8 @@ static inline int red_is_stream_start(Drawable *drawable)
(RED_STREAM_GRADUAL_FRAMES_START_CONDITION * drawable->frames_count)));
}
-static void red_stream_add_frame(RedWorker* worker, Drawable *frame_drawable,
+// returns whether a stream was created
+static int red_stream_add_frame(RedWorker* worker, Drawable *frame_drawable,
int frames_count,
int gradual_frames_count,
int last_gradual_frame)
@@ -2757,7 +2758,9 @@ static void red_stream_add_frame(RedWorker* worker, Drawable *frame_drawable,
if (red_is_stream_start(frame_drawable)) {
red_create_stream(worker, frame_drawable);
+ return TRUE;
}
+ return FALSE;
}
static inline void red_stream_maintenance(RedWorker *worker, Drawable *candidate, Drawable *prev)
@@ -2890,10 +2893,12 @@ static inline void red_use_stream_trace(RedWorker *worker, Drawable *drawable)
for (; trace < trace_end; trace++) {
if (__red_is_next_stream_frame(worker, drawable, trace->width, trace->height,
&trace->dest_area, trace->time, NULL)) {
- red_stream_add_frame(worker, drawable,
- trace->frames_count,
- trace->gradual_frames_count,
- trace->last_gradual_frame);
+ if (red_stream_add_frame(worker, drawable,
+ trace->frames_count,
+ trace->gradual_frames_count,
+ trace->last_gradual_frame)) {
+ return;
+ }
}
}
}