[glib/resources] Push ownership of the resource content into the gvdb table



commit 6bcd53ee105c6bc2cd15423c08ceabe173d7fc1c
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 22 13:58:48 2011 +0100

    Push ownership of the resource content into the gvdb table
    
    This shouldn't make much difference, but means less places
    to track ownership.

 gio/gresource.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gio/gresource.c b/gio/gresource.c
index 5736e67..22bc335 100644
--- a/gio/gresource.c
+++ b/gio/gresource.c
@@ -36,7 +36,6 @@ struct _GResource
   int ref_count;
 
   GvdbTable *table;
-  GBytes *data;
 };
 
 /**
@@ -75,8 +74,6 @@ g_resource_unref (GResource *resource)
   if (resource->ref_count-- == 0)
     {
       gvdb_table_unref (resource->table);
-      if (resource->data)
-	g_bytes_unref (resource->data);
       g_free (resource);
     }
 }
@@ -91,9 +88,9 @@ g_resource_new_from_data (GBytes *data,
   table = gvdb_table_new_from_data (g_bytes_get_data (data, NULL),
 				    g_bytes_get_size (data),
 				    TRUE,
-				    NULL,
-				    NULL,
-				    NULL,
+				    g_bytes_ref (data),
+				    (GvdbRefFunc)g_bytes_ref,
+				    (GDestroyNotify)g_bytes_unref,
 				    error);
 
   if (table == NULL)
@@ -101,7 +98,6 @@ g_resource_new_from_data (GBytes *data,
 
   resource = g_new0 (GResource, 1);
   resource->table = table;
-  resource->data = g_bytes_ref (data);
 
   return resource;
 }



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