[libvirt] [libvirt-glib] The input stream is owned by GVirStream, don't ref it

--- libvirt-gobject/libvirt-gobject-input-stream.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libvirt-gobject/libvirt-gobject-input-stream.c b/libvirt-gobject/libvirt-gobject-input-stream.c index a76d670..39459c4 100644 --- a/libvirt-gobject/libvirt-gobject-input-stream.c +++ b/libvirt-gobject/libvirt-gobject-input-stream.c @@ -80,7 +80,7 @@ static void gvir_input_stream_set_property(GObject *object, switch (prop_id) { case PROP_STREAM: - stream->priv->stream = g_value_dup_object(value); + stream->priv->stream = g_value_get_object(value); break; default: @@ -92,8 +92,8 @@ static void gvir_input_stream_finalize(GObject *object) { GVirInputStream *stream = GVIR_INPUT_STREAM(object); - if (stream->priv->stream) - g_object_unref(stream->priv->stream); + DEBUG("Finalize input stream GVirStream=%p", stream->priv->stream); + stream->priv->stream = NULL; // unowned if (G_OBJECT_CLASS(gvir_input_stream_parent_class)->finalize) (*G_OBJECT_CLASS(gvir_input_stream_parent_class)->finalize)(object); -- 1.7.6.2

Hey, It took me a bit of time to understand that GVirInputStream is an internal object and that the only way to get one is to go through GVirStream. ACK from me. Christophe On Tue, Oct 11, 2011 at 07:38:45PM +0200, Marc-André Lureau wrote:
--- libvirt-gobject/libvirt-gobject-input-stream.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-input-stream.c b/libvirt-gobject/libvirt-gobject-input-stream.c index a76d670..39459c4 100644 --- a/libvirt-gobject/libvirt-gobject-input-stream.c +++ b/libvirt-gobject/libvirt-gobject-input-stream.c @@ -80,7 +80,7 @@ static void gvir_input_stream_set_property(GObject *object,
switch (prop_id) { case PROP_STREAM: - stream->priv->stream = g_value_dup_object(value); + stream->priv->stream = g_value_get_object(value); break;
default: @@ -92,8 +92,8 @@ static void gvir_input_stream_finalize(GObject *object) { GVirInputStream *stream = GVIR_INPUT_STREAM(object);
- if (stream->priv->stream) - g_object_unref(stream->priv->stream); + DEBUG("Finalize input stream GVirStream=%p", stream->priv->stream); + stream->priv->stream = NULL; // unowned
if (G_OBJECT_CLASS(gvir_input_stream_parent_class)->finalize) (*G_OBJECT_CLASS(gvir_input_stream_parent_class)->finalize)(object); -- 1.7.6.2
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Christophe Fergeau
-
Marc-André Lureau