[libdmapsharing] Fix reference counting of thumbnails and hashes



commit c61af81f60e43c50558ddbab0a9a69122b19d671
Author: W. Michael Petullo <mike flyn org>
Date:   Sun Mar 17 23:05:00 2019 -0400

    Fix reference counting of thumbnails and hashes
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/test-dmap-av-record.c    | 4 ++--
 libdmapsharing/test-dmap-image-record.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/libdmapsharing/test-dmap-av-record.c b/libdmapsharing/test-dmap-av-record.c
index 856019a..f9afc0a 100644
--- a/libdmapsharing/test-dmap-av-record.c
+++ b/libdmapsharing/test-dmap-av-record.c
@@ -158,7 +158,7 @@ test_dmap_av_record_set_property (GObject *object,
                        if (record->priv->hash) {
                                g_array_unref(record->priv->hash);
                        }
-                       record->priv->hash = g_value_get_boxed (value);
+                       record->priv->hash = g_array_ref(g_value_get_boxed (value));
                        break;
                 default:
                         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -236,7 +236,7 @@ test_dmap_av_record_get_property (GObject *object,
                         g_value_set_enum (value, record->priv->mediakind);
                        break;
                case PROP_HASH:
-                       g_value_set_boxed (value, record->priv->hash);
+                       g_value_set_boxed (value, g_array_ref(record->priv->hash));
                        break;
                 default:
                         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/libdmapsharing/test-dmap-image-record.c b/libdmapsharing/test-dmap-image-record.c
index 3b71ec3..86d1d26 100644
--- a/libdmapsharing/test-dmap-image-record.c
+++ b/libdmapsharing/test-dmap-image-record.c
@@ -98,13 +98,13 @@ test_dmap_image_record_set_property (GObject *object,
                        if (record->priv->thumbnail) {
                                g_array_unref(record->priv->thumbnail);
                        }
-                        record->priv->thumbnail = g_value_get_boxed (value);
+                        record->priv->thumbnail = g_array_ref(g_value_get_boxed (value));
                         break;
                 case PROP_HASH:
                        if (record->priv->hash) {
                                g_array_unref(record->priv->hash);
                        }
-                        record->priv->hash = g_value_get_boxed (value);
+                        record->priv->hash = g_array_ref(g_value_get_boxed (value));
                         break;
                 case PROP_COMMENTS:
                        g_free (record->priv->comments);
@@ -154,10 +154,10 @@ test_dmap_image_record_get_property (GObject *object,
                         g_value_set_string (value, record->priv->format);
                         break;
                 case PROP_THUMBNAIL:
-                       g_value_set_boxed (value, record->priv->thumbnail);
+                       g_value_set_boxed (value, g_array_ref(record->priv->thumbnail));
                         break;
                 case PROP_HASH:
-                       g_value_set_boxed (value, record->priv->hash);
+                       g_value_set_boxed (value, g_array_ref(record->priv->hash));
                         break;
                 case PROP_COMMENTS:
                         g_value_set_string (value, record->priv->comments);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]