[gdk-pixbuf] tests: Fix bug in pixdata test



commit 28fbde8f87385c699f5693d95c07076cac204baa
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Dec 16 16:17:42 2016 +0100

    tests: Fix bug in pixdata test
    
    In 3724a739 we added a test for the deserializing code, but we shouldn't
    be free'ing the contents straight away, as gdk_pixdata_deserialize()
    does not copy the data, but expects it to stay around until we've copied
    the data to the pixbuf (with gdk_pixbuf_from_pixdata() and copy_pixels
    == TRUE), or we're done with the pixbuf.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775693

 tests/pixbuf-pixdata.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/tests/pixbuf-pixdata.c b/tests/pixbuf-pixdata.c
index a81e41c..8746440 100644
--- a/tests/pixbuf-pixdata.c
+++ b/tests/pixbuf-pixdata.c
@@ -41,11 +41,11 @@ test_pixdata_deserialize (gconstpointer data)
 
   gdk_pixdata_deserialize (&pixdata, size, (const guint8 *) contents, &error);
   g_assert_no_error (error);
-  g_free (contents);
 
   pixbuf = gdk_pixbuf_from_pixdata (&pixdata, TRUE, &error);
   g_assert_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE);
   g_clear_error (&error);
+  g_free (contents);
 
   pixbuf = gdk_pixbuf_from_pixdata (&pixdata, FALSE, &error);
   g_assert_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE);


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