--- server/red-parse-qxl.c | 6 ++++-- server/red-parse-qxl.h | 3 ++- server/red-worker.c | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c index 5408cfa5a..d7ae53804 100644 --- a/server/red-parse-qxl.c +++ b/server/red-parse-qxl.c @@ -1280,7 +1280,7 @@ void red_put_update_cmd(RedUpdateCmd *red) /* nothing yet */ } -bool red_get_message(RedMemSlotInfo *slots, int group_id, +bool red_get_message(QXLInstance *qxl, RedMemSlotInfo *slots, int group_id, RedMessage *red, QXLPHYSICAL addr) { QXLMessage *qxl_msg; @@ -1299,6 +1299,7 @@ bool red_get_message(RedMemSlotInfo *slots, int group_id, if (error) { return false; } + red->qxl = qxl; red->release_info_ext.info = &qxl_msg->release_info; red->release_info_ext.group_id = group_id; red->data = qxl_msg->data; @@ -1315,7 +1316,8 @@ bool red_get_message(RedMemSlotInfo *slots, int group_id, void red_put_message(RedMessage *red) { - /* nothing yet */ + if (red->qxl != NULL) + red_qxl_release_resource(red->qxl, red->release_info_ext); } static unsigned int surface_format_to_bpp(uint32_t format) diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h index 231844e96..c73462e0e 100644 --- a/server/red-parse-qxl.h +++ b/server/red-parse-qxl.h @@ -75,6 +75,7 @@ typedef struct RedUpdateCmd { } RedUpdateCmd; typedef struct RedMessage { + QXLInstance *qxl; QXLReleaseInfoExt release_info_ext; int len; uint8_t *data; @@ -127,7 +128,7 @@ bool red_get_update_cmd(RedMemSlotInfo *slots, int group_id, RedUpdateCmd *red, QXLPHYSICAL addr); void red_put_update_cmd(RedUpdateCmd *red); -bool red_get_message(RedMemSlotInfo *slots, int group_id, +bool red_get_message(QXLInstance *qxl, RedMemSlotInfo *slots, int group_id, RedMessage *red, QXLPHYSICAL addr); void red_put_message(RedMessage *red); diff --git a/server/red-worker.c b/server/red-worker.c index 2dcf2b0ef..762443f7c 100644 --- a/server/red-worker.c +++ b/server/red-worker.c @@ -238,14 +238,13 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty) case QXL_CMD_MESSAGE: { RedMessage message; - if (!red_get_message(&worker->mem_slots, ext_cmd.group_id, + if (!red_get_message(worker->qxl, &worker->mem_slots, ext_cmd.group_id, &message, ext_cmd.cmd.data)) { break; } #ifdef DEBUG spice_warning("MESSAGE: %.*s", message.len, message.data); #endif - red_qxl_release_resource(worker->qxl, message.release_info_ext); red_put_message(&message); break; } -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel