[virt-tools-list] [virt-viewer v1] Take reference to monitor the file transfer task
Christophe Fergeau
cfergeau at redhat.com
Tue Jul 12 13:38:52 UTC 2016
On Tue, Jul 12, 2016 at 02:19:02PM +0200, Victor Toso wrote:
> Documentation states that:
> "Client applications may take a reference on the @task object and use
> it to monitor the status of the file transfer task."
>
> We have been monitoring SpiceFileTransferTask without reference it but
> since the introduction of file transfer dialog we also unref it after
> task is finished (on task_finished_remove) leading to critical
> warnings when task original reference has been freed already.
>
> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
> src/virt-viewer-session-spice.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index 731f074..fdbfd5d 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -943,7 +943,7 @@ on_new_file_transfer(SpiceMainChannel *channel G_GNUC_UNUSED,
> {
> VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(user_data);
> virt_viewer_file_transfer_dialog_add_task(self->priv->file_transfer_dialog,
> - task);
> + g_object_ref(task));
Hey, _add_task() is already taking a reference on the task through
g_hash_table_insert(self->priv->file_transfers, g_object_ref(task), w);
and then _task_finish() does:
d->task = task;
g_hash_table_steal(self->priv->file_transfers, task);
at that point, 'd' should have ownership of the task. I don't
see where the reference you add would be released.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20160712/76af048d/attachment.sig>
More information about the virt-tools-list
mailing list