Keep a reference to the framebuffer while it is in a worker.

tight-png
Andri Yngvason 2019-10-08 17:53:12 +00:00
parent bc17fd823e
commit 9501a1da64
1 changed files with 4 additions and 1 deletions

View File

@ -111,7 +111,7 @@ struct fb_update_work {
struct pixman_region16 region; struct pixman_region16 region;
struct rfb_pixel_format server_fmt; struct rfb_pixel_format server_fmt;
struct vec frame; struct vec frame;
const struct nvnc_fb *fb; struct nvnc_fb *fb;
}; };
int schedule_client_update_fb(struct nvnc_client *client); int schedule_client_update_fb(struct nvnc_client *client);
@ -897,6 +897,7 @@ void on_client_update_fb_done(uv_work_t *work, int status)
client->is_updating = false; client->is_updating = false;
client->n_pending_requests--; client->n_pending_requests--;
process_fb_update_requests(client); process_fb_update_requests(client);
nvnc_fb_unref(update->fb);
client_unref(client); client_unref(client);
} }
@ -924,6 +925,7 @@ int schedule_client_update_fb(struct nvnc_client *client)
goto vec_failure; goto vec_failure;
client_ref(client); client_ref(client);
nvnc_fb_ref(fb);
rc = uv_queue_work(uv_default_loop(), &work->work, do_client_update_fb, rc = uv_queue_work(uv_default_loop(), &work->work, do_client_update_fb,
on_client_update_fb_done); on_client_update_fb_done);
@ -933,6 +935,7 @@ int schedule_client_update_fb(struct nvnc_client *client)
return 0; return 0;
queue_failure: queue_failure:
nvnc_fb_unref(fb);
client_unref(client); client_unref(client);
vec_destroy(&work->frame); vec_destroy(&work->frame);
vec_failure: vec_failure: