From 95742676c9a302b0ae24f67a85626e2e23951758 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 30 Oct 2022 12:32:27 +0000 Subject: [PATCH] zrle: Keep reference to encoder while encoding --- src/zrle.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zrle.c b/src/zrle.c index 779c0dd..e6ecd74 100644 --- a/src/zrle.c +++ b/src/zrle.c @@ -378,6 +378,7 @@ static void zrle_encoder_on_done(void* obj) encoder_finish_frame(&self->encoder, result, pts); rcbuf_unref(result); + encoder_unref(&self->encoder); } struct encoder* zrle_encoder_new(void) @@ -439,8 +440,11 @@ static int zrle_encoder_encode(struct encoder* encoder, struct nvnc_fb* fb, nvnc_fb_ref(self->current_fb); pixman_region_copy(&self->current_damage, damage); + encoder_ref(&self->encoder); + int rc = aml_start(aml_get_default(), self->work); if (rc < 0) { + encoder_unref(&self->encoder); aml_unref(self->work); self->work = NULL; pixman_region_clear(&self->current_damage);