[Spice-devel] [PATCH v2 8/9] Change RedCharDevice::write_queue to GQueue

Jonathon Jongsma jjongsma at redhat.com
Fri Sep 16 15:46:20 UTC 2016


On Thu, 2016-09-15 at 14:51 -0500, Jonathon Jongsma wrote:
> On Thu, 2016-09-15 at 16:55 +0200, Pavel Grunt wrote:
> > 
> > Hey,
> > 
> > On Wed, 2016-09-14 at 11:53 -0500, Jonathon Jongsma wrote:
> > > 
> > > 
> > > Change a couple more Rings to GQueue
> > > ---
> > > Changes in v2:
> > >  - use GQueue, not GList
> > > 
> > >  server/char-device.c | 79 +++++++++++++++++++++-----------------
> > > -
> > > -------------
> > > 
> 
> 
> > 
> > > 
> > > @@ -1119,8 +1104,8 @@ red_char_device_finalize(GObject *object)
> > >          reds_core_timer_remove(self->priv->reds, self->priv-
> > > > 
> > > > 
> > > > write_to_dev_timer);
> > >          self->priv->write_to_dev_timer = NULL;
> > >      }
> > > -    write_buffers_queue_free(&self->priv->write_queue);
> > > -    write_buffers_queue_free(&self->priv->write_bufs_pool);
> > > +    write_buffers_queue_free(self->priv->write_queue);
> > > +    write_buffers_queue_free(self->priv->write_bufs_pool);
> > 
> > Did you consider using g_queue_free_full() ?
> > 
> > Thanks,
> > Pavel
> > 
> 
> 
> I did consider it, but that would free the GQueue structure as well
> as
> all of the elements in the queue. I don't want to do that here. We
> want
> a valid GQueue, but it should be empty.
> 

I wrote a follow-up to this yesterday but it seems I forgot to send
it? 

Anyway, I misspoke here. I was thinking of a different code location
where I was considerin g_queue_free_full. I could indeed have used it
here. But you've probably noticed that my updated patch switched to
storing the GQueue in the struct by value rather by pointer. So it no
longer needs to be freed independantly.

Jonathon


More information about the Spice-devel mailing list