[virt-tools-list] [virt-viewer v1] Take reference to monitor the file transfer task

Victor Toso victortoso at redhat.com
Tue Jul 12 14:07:40 UTC 2016


Hi,

On Tue, Jul 12, 2016 at 03:38:52PM +0200, Christophe Fergeau wrote:
> 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.

You are right. Bug is likely on spice-gtk... I'll take a look!
Many thanks

>
> Christophe





More information about the virt-tools-list mailing list