@@ -234,7 +234,6 @@ static int vnc_worker_thread_loop(VncJob
vnc_unlock_output(job->vs);
goto disconnected;
}
- vnc_unlock_output(job->vs);
/* Make a local copy of vs and switch output buffers */
vnc_async_encoding_start(job->vs, &vs);
@@ -252,6 +251,8 @@ static int vnc_worker_thread_loop(VncJob
if (job->vs->csock == -1) {
vnc_unlock_display(job->vs->vd);
+ vnc_async_encoding_end(job->vs, &vs);
+ vnc_unlock_output(job->vs);
goto disconnected;
}
@@ -269,7 +270,6 @@ static int vnc_worker_thread_loop(VncJob
vs.output.buffer[saved_offset] = (n_rectangles >> 8) & 0xFF;
vs.output.buffer[saved_offset + 1] = n_rectangles & 0xFF;
- vnc_lock_output(job->vs);
if (job->vs->csock != -1) {
buffer_reserve(&job->vs->jobs_buffer, vs.output.offset);
buffer_append(&job->vs->jobs_buffer, vs.output.buffer,
@@ -278,6 +278,8 @@ static int vnc_worker_thread_loop(VncJob
vnc_async_encoding_end(job->vs, &vs);
qemu_bh_schedule(job->vs->bh);
+ } else {
+ vnc_async_encoding_end(job->vs, &vs);
}
vnc_unlock_output(job->vs);