[gexiv2] Add clean-up declarations for g_autoptr



commit 1a19954d3833717ac76e4a6fda70b7fe9aed9741
Author: Jens Georg <mail jensge org>
Date:   Sun Dec 24 11:57:04 2017 +0100

    Add clean-up declarations for g_autoptr
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790925

 gexiv2/gexiv2-metadata.h           |    2 ++
 gexiv2/gexiv2-preview-image.h      |    3 +++
 gexiv2/gexiv2-preview-properties.h |    2 ++
 test/gexiv2-regression.c           |   23 +++++++++++++++++++++++
 4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gexiv2/gexiv2-metadata.h b/gexiv2/gexiv2-metadata.h
index 51f0a91..1b21c0e 100644
--- a/gexiv2/gexiv2-metadata.h
+++ b/gexiv2/gexiv2-metadata.h
@@ -178,6 +178,8 @@ typedef struct _GExiv2Metadata                      GExiv2Metadata;
 typedef struct _GExiv2MetadataClass            GExiv2MetadataClass;
 typedef struct _GExiv2MetadataPrivate  GExiv2MetadataPrivate;
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GExiv2Metadata, g_object_unref)
+
 struct _GExiv2Metadata
 {
        GObject parent_instance;
diff --git a/gexiv2/gexiv2-preview-image.h b/gexiv2/gexiv2-preview-image.h
index c629f61..f61b55a 100644
--- a/gexiv2/gexiv2-preview-image.h
+++ b/gexiv2/gexiv2-preview-image.h
@@ -34,10 +34,13 @@ G_BEGIN_DECLS
        (G_TYPE_INSTANCE_GET_CLASS ((obj), GEXIV2_TYPE_PREVIEW_IMAGE, GExiv2PreviewImageClass))
        
 
+
 typedef struct _GExiv2PreviewImage                     GExiv2PreviewImage;
 typedef struct _GExiv2PreviewImageClass                GExiv2PreviewImageClass;
 typedef struct _GExiv2PreviewImagePrivate      GExiv2PreviewImagePrivate;
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GExiv2PreviewImage, g_object_unref)
+
 struct _GExiv2PreviewImage
 {
        GObject parent_instance;
diff --git a/gexiv2/gexiv2-preview-properties.h b/gexiv2/gexiv2-preview-properties.h
index 6cbec61..3c046e2 100644
--- a/gexiv2/gexiv2-preview-properties.h
+++ b/gexiv2/gexiv2-preview-properties.h
@@ -38,6 +38,8 @@ typedef struct _GExiv2PreviewProperties                       GExiv2PreviewProperties;
 typedef struct _GExiv2PreviewPropertiesClass   GExiv2PreviewPropertiesClass;
 typedef struct _GExiv2PreviewPropertiesPrivate GExiv2PreviewPropertiesPrivate;
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GExiv2PreviewProperties, g_object_unref)
+
 struct _GExiv2PreviewProperties
 {
        GObject parent_instance;
diff --git a/test/gexiv2-regression.c b/test/gexiv2-regression.c
index 71424dc..44b8d70 100644
--- a/test/gexiv2-regression.c
+++ b/test/gexiv2-regression.c
@@ -86,12 +86,35 @@ static void test_bgo_730136(void)
     g_clear_pointer (&raw_tag, g_bytes_unref);
 }
 
+static void test_bgo_790925(void)
+{
+    g_autoptr(GExiv2Metadata) meta = NULL;
+    g_autoptr(GExiv2PreviewImage) image = NULL;
+    GExiv2PreviewProperties **props = NULL;
+    GError *error = NULL;
+    gboolean result = FALSE;
+
+    meta = gexiv2_metadata_new ();
+    g_assert_nonnull (meta);
+
+    result = gexiv2_metadata_open_path (meta, SAMPLE_PATH "/original.jpg", &error);
+    g_assert_no_error(error);
+    g_assert_true(result);
+
+    props = gexiv2_metadata_get_preview_properties (meta);
+    g_assert_nonnull (props);
+
+    image = gexiv2_metadata_get_preview_image (meta, *props);
+    g_assert_nonnull(image);
+}
+
 int main(int argc, char *argv[static argc + 1])
 {
     g_test_init(&argc, &argv, NULL);
     g_test_add_func("/bugs/gnome/775249", test_bgo_775249);
     g_test_add_func("/bugs/gnome/730136", test_bgo_730136);
     g_test_add_func("/bugs/gnome/792239", test_bgo_792239);
+    g_test_add_func("/bugs/gnome/790925", test_bgo_790925);
 
     return g_test_run();
 }


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