[mutter] cogl: Stop using GSlice



commit df4508e8cf990762a6f3d1bbc8fe2256efb7c533
Author: Robert Mader <robert mader posteo de>
Date:   Sun Oct 18 13:46:08 2020 +0200

    cogl: Stop using GSlice
    
    It has been inofficially deprecated for years, is known to cause issues
    with valgrind and potentially hides memory corruption.
    Lets stop using it.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1512>

 cogl/cogl-pango/cogl-pango-display-list.c        | 12 ++++++------
 cogl/cogl-pango/cogl-pango-glyph-cache.c         |  8 ++++----
 cogl/cogl-pango/cogl-pango-pipeline-cache.c      |  8 ++++----
 cogl/cogl-pango/cogl-pango-render.c              |  4 ++--
 cogl/cogl/cogl-attribute-buffer.c                |  4 ++--
 cogl/cogl/cogl-attribute.c                       |  6 +++---
 cogl/cogl/cogl-bitmap.c                          |  4 ++--
 cogl/cogl/cogl-clip-stack.c                      | 10 +++++-----
 cogl/cogl/cogl-closure-list.c                    |  4 ++--
 cogl/cogl/cogl-color.c                           |  6 +++---
 cogl/cogl/cogl-display.c                         |  4 ++--
 cogl/cogl/cogl-fence.c                           |  4 ++--
 cogl/cogl/cogl-frame-info.c                      |  4 ++--
 cogl/cogl/cogl-index-buffer.c                    |  4 ++--
 cogl/cogl/cogl-indices.c                         |  4 ++--
 cogl/cogl/cogl-journal.c                         |  4 ++--
 cogl/cogl/cogl-matrix-stack.c                    |  4 ++--
 cogl/cogl/cogl-memory-stack.c                    |  8 ++++----
 cogl/cogl/cogl-onscreen-template.c               |  4 ++--
 cogl/cogl/cogl-onscreen.c                        |  8 ++++----
 cogl/cogl/cogl-output.c                          |  4 ++--
 cogl/cogl/cogl-pipeline-hash-table.c             |  4 ++--
 cogl/cogl/cogl-pipeline-layer.c                  | 14 +++++++-------
 cogl/cogl/cogl-pipeline-private.h                |  4 ++--
 cogl/cogl/cogl-pipeline.c                        | 19 +++++++++----------
 cogl/cogl/cogl-pixel-buffer.c                    |  4 ++--
 cogl/cogl/cogl-poll.c                            |  8 ++++----
 cogl/cogl/cogl-primitive.c                       | 19 +++++++------------
 cogl/cogl/cogl-rectangle-map.c                   |  4 ++--
 cogl/cogl/cogl-renderer.c                        |  4 ++--
 cogl/cogl/cogl-sampler-cache.c                   |  8 ++++----
 cogl/cogl/cogl-snippet.c                         |  4 ++--
 cogl/cogl/cogl-swap-chain.c                      |  4 ++--
 cogl/cogl/cogl-texture.c                         |  4 ++--
 cogl/cogl/cogl-xlib-renderer.c                   |  4 ++--
 cogl/cogl/deprecated/cogl-program.c              |  4 ++--
 cogl/cogl/deprecated/cogl-shader.c               |  4 ++--
 cogl/cogl/driver/gl/cogl-attribute-gl.c          |  4 ++--
 cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 10 +++++-----
 cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c |  4 ++--
 cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c |  4 ++--
 cogl/cogl/winsys/cogl-winsys-egl-x11.c           |  8 ++++----
 cogl/cogl/winsys/cogl-winsys-egl.c               |  4 ++--
 cogl/cogl/winsys/cogl-winsys-glx.c               |  8 ++++----
 44 files changed, 133 insertions(+), 139 deletions(-)
---
diff --git a/cogl/cogl-pango/cogl-pango-display-list.c b/cogl/cogl-pango/cogl-pango-display-list.c
index 2e5b6414fc..44db4c4724 100644
--- a/cogl/cogl-pango/cogl-pango-display-list.c
+++ b/cogl/cogl-pango/cogl-pango-display-list.c
@@ -100,7 +100,7 @@ struct _CoglPangoDisplayListNode
 CoglPangoDisplayList *
 _cogl_pango_display_list_new (CoglPangoPipelineCache *pipeline_cache)
 {
-  CoglPangoDisplayList *dl = g_slice_new0 (CoglPangoDisplayList);
+  CoglPangoDisplayList *dl = g_new0 (CoglPangoDisplayList, 1);
 
   dl->pipeline_cache = pipeline_cache;
 
@@ -161,7 +161,7 @@ _cogl_pango_display_list_add_texture (CoglPangoDisplayList *dl,
   else
     {
       /* Otherwise create a new node */
-      node = g_slice_new (CoglPangoDisplayListNode);
+      node = g_new0 (CoglPangoDisplayListNode, 1);
 
       node->type = COGL_PANGO_DISPLAY_LIST_TEXTURE;
       node->color_override = dl->color_override;
@@ -195,7 +195,7 @@ _cogl_pango_display_list_add_rectangle (CoglPangoDisplayList *dl,
                                         float x_1, float y_1,
                                         float x_2, float y_2)
 {
-  CoglPangoDisplayListNode *node = g_slice_new (CoglPangoDisplayListNode);
+  CoglPangoDisplayListNode *node = g_new0 (CoglPangoDisplayListNode, 1);
 
   node->type = COGL_PANGO_DISPLAY_LIST_RECTANGLE;
   node->color_override = dl->color_override;
@@ -219,7 +219,7 @@ _cogl_pango_display_list_add_trapezoid (CoglPangoDisplayList *dl,
                                         float x_22)
 {
   CoglContext *ctx = dl->pipeline_cache->ctx;
-  CoglPangoDisplayListNode *node = g_slice_new (CoglPangoDisplayListNode);
+  CoglPangoDisplayListNode *node = g_new0 (CoglPangoDisplayListNode, 1);
   CoglVertexP2 vertices[4] = {
         { x_11, y_1 },
         { x_12, y_2 },
@@ -470,7 +470,7 @@ _cogl_pango_display_list_node_free (CoglPangoDisplayListNode *node)
   if (node->pipeline)
     cogl_object_unref (node->pipeline);
 
-  g_slice_free (CoglPangoDisplayListNode, node);
+  g_free (node);
 }
 
 void
@@ -486,5 +486,5 @@ void
 _cogl_pango_display_list_free (CoglPangoDisplayList *dl)
 {
   _cogl_pango_display_list_clear (dl);
-  g_slice_free (CoglPangoDisplayList, dl);
+  g_free (dl);
 }
diff --git a/cogl/cogl-pango/cogl-pango-glyph-cache.c b/cogl/cogl-pango/cogl-pango-glyph-cache.c
index 10b73d7522..47550491c3 100644
--- a/cogl/cogl-pango/cogl-pango-glyph-cache.c
+++ b/cogl/cogl-pango/cogl-pango-glyph-cache.c
@@ -77,14 +77,14 @@ cogl_pango_glyph_cache_value_free (CoglPangoGlyphCacheValue *value)
 {
   if (value->texture)
     cogl_object_unref (value->texture);
-  g_slice_free (CoglPangoGlyphCacheValue, value);
+  g_free (value);
 }
 
 static void
 cogl_pango_glyph_cache_key_free (CoglPangoGlyphCacheKey *key)
 {
   g_object_unref (key->font);
-  g_slice_free (CoglPangoGlyphCacheKey, key);
+  g_free (key);
 }
 
 static unsigned int
@@ -326,7 +326,7 @@ cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
       CoglPangoGlyphCacheKey *key;
       PangoRectangle ink_rect;
 
-      value = g_slice_new (CoglPangoGlyphCacheValue);
+      value = g_new0 (CoglPangoGlyphCacheValue, 1);
       value->texture = NULL;
 
       pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
@@ -362,7 +362,7 @@ cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
           cache->has_dirty_glyphs = TRUE;
         }
 
-      key = g_slice_new (CoglPangoGlyphCacheKey);
+      key = g_new0 (CoglPangoGlyphCacheKey, 1);
       key->font = g_object_ref (font);
       key->glyph = glyph;
 
diff --git a/cogl/cogl-pango/cogl-pango-pipeline-cache.c b/cogl/cogl-pango/cogl-pango-pipeline-cache.c
index fdc340908d..566a1b079b 100644
--- a/cogl/cogl-pango/cogl-pango-pipeline-cache.c
+++ b/cogl/cogl-pango/cogl-pango-pipeline-cache.c
@@ -69,7 +69,7 @@ _cogl_pango_pipeline_cache_value_destroy (void *data)
   /* We don't need to unref the pipeline because it only takes a weak
      reference */
 
-  g_slice_free (CoglPangoPipelineCacheEntry, cache_entry);
+  g_free (cache_entry);
 }
 
 CoglPangoPipelineCache *
@@ -164,7 +164,7 @@ pipeline_destroy_notify_cb (void *user_data)
   PipelineDestroyNotifyData *data = user_data;
 
   g_hash_table_remove (data->cache->hash_table, data->texture);
-  g_slice_free (PipelineDestroyNotifyData, data);
+  g_free (data);
 }
 
 CoglPipeline *
@@ -182,7 +182,7 @@ _cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
     return cogl_object_ref (entry->pipeline);
 
   /* No existing pipeline was found so let's create another */
-  entry = g_slice_new (CoglPangoPipelineCacheEntry);
+  entry = g_new0 (CoglPangoPipelineCacheEntry, 1);
 
   if (texture)
     {
@@ -207,7 +207,7 @@ _cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
 
   /* Add a weak reference to the pipeline so we can remove it from the
      hash table when it is destroyed */
-  destroy_data = g_slice_new (PipelineDestroyNotifyData);
+  destroy_data = g_new0 (PipelineDestroyNotifyData, 1);
   destroy_data->cache = cache;
   destroy_data->texture = texture;
   cogl_object_set_user_data (COGL_OBJECT (entry->pipeline),
diff --git a/cogl/cogl-pango/cogl-pango-render.c b/cogl/cogl-pango/cogl-pango-render.c
index 07ba0ca4b1..108925aeb5 100644
--- a/cogl/cogl-pango/cogl-pango-render.c
+++ b/cogl/cogl-pango/cogl-pango-render.c
@@ -365,7 +365,7 @@ cogl_pango_render_qdata_destroy (CoglPangoLayoutQdata *qdata)
   cogl_pango_layout_qdata_forget_display_list (qdata);
   if (qdata->first_line)
     pango_layout_line_unref (qdata->first_line);
-  g_slice_free (CoglPangoLayoutQdata, qdata);
+  g_free (qdata);
 }
 
 void
@@ -389,7 +389,7 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
 
   if (qdata == NULL)
     {
-      qdata = g_slice_new0 (CoglPangoLayoutQdata);
+      qdata = g_new0 (CoglPangoLayoutQdata, 1);
       qdata->renderer = priv;
       g_object_set_qdata_full (G_OBJECT (layout),
                                cogl_pango_layout_get_qdata_key (),
diff --git a/cogl/cogl/cogl-attribute-buffer.c b/cogl/cogl/cogl-attribute-buffer.c
index 6617de304b..072fcfd323 100644
--- a/cogl/cogl/cogl-attribute-buffer.c
+++ b/cogl/cogl/cogl-attribute-buffer.c
@@ -48,7 +48,7 @@ CoglAttributeBuffer *
 cogl_attribute_buffer_new_with_size (CoglContext *context,
                                      size_t bytes)
 {
-  CoglAttributeBuffer *buffer = g_slice_new (CoglAttributeBuffer);
+  CoglAttributeBuffer *buffer = g_new0 (CoglAttributeBuffer, 1);
 
   /* parent's constructor */
   _cogl_buffer_initialize (COGL_BUFFER (buffer),
@@ -97,6 +97,6 @@ _cogl_attribute_buffer_free (CoglAttributeBuffer *array)
   /* parent's destructor */
   _cogl_buffer_fini (COGL_BUFFER (array));
 
-  g_slice_free (CoglAttributeBuffer, array);
+  g_free (array);
 }
 
diff --git a/cogl/cogl/cogl-attribute.c b/cogl/cogl/cogl-attribute.c
index a872739d71..3ccd7b9dd8 100644
--- a/cogl/cogl/cogl-attribute.c
+++ b/cogl/cogl/cogl-attribute.c
@@ -190,7 +190,7 @@ cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
                     int n_components,
                     CoglAttributeType type)
 {
-  CoglAttribute *attribute = g_slice_new (CoglAttribute);
+  CoglAttribute *attribute = g_new0 (CoglAttribute, 1);
   CoglBuffer *buffer = COGL_BUFFER (attribute_buffer);
   CoglContext *ctx = buffer->context;
 
@@ -240,7 +240,7 @@ _cogl_attribute_new_const (CoglContext *context,
                            gboolean transpose,
                            const float *value)
 {
-  CoglAttribute *attribute = g_slice_new (CoglAttribute);
+  CoglAttribute *attribute = g_new0 (CoglAttribute, 1);
 
   attribute->name_state =
     g_hash_table_lookup (context->attribute_name_states_hash, name);
@@ -521,7 +521,7 @@ _cogl_attribute_free (CoglAttribute *attribute)
   else
     _cogl_boxed_value_destroy (&attribute->d.constant.boxed);
 
-  g_slice_free (CoglAttribute, attribute);
+  g_free (attribute);
 }
 
 static gboolean
diff --git a/cogl/cogl/cogl-bitmap.c b/cogl/cogl/cogl-bitmap.c
index f5577e3420..e44b1f9557 100644
--- a/cogl/cogl/cogl-bitmap.c
+++ b/cogl/cogl/cogl-bitmap.c
@@ -58,7 +58,7 @@ _cogl_bitmap_free (CoglBitmap *bmp)
   if (bmp->buffer)
     cogl_object_unref (bmp->buffer);
 
-  g_slice_free (CoglBitmap, bmp);
+  g_free (bmp);
 }
 
 gboolean
@@ -190,7 +190,7 @@ cogl_bitmap_new_for_data (CoglContext *context,
   if (rowstride == 0)
     rowstride = width * cogl_pixel_format_get_bytes_per_pixel (format, 0);
 
-  bmp = g_slice_new (CoglBitmap);
+  bmp = g_new0 (CoglBitmap, 1);
   bmp->context = context;
   bmp->format = format;
   bmp->width = width;
diff --git a/cogl/cogl/cogl-clip-stack.c b/cogl/cogl/cogl-clip-stack.c
index 66adfae364..4212810aef 100644
--- a/cogl/cogl/cogl-clip-stack.c
+++ b/cogl/cogl/cogl-clip-stack.c
@@ -53,7 +53,7 @@ _cogl_clip_stack_push_entry (CoglClipStack *clip_stack,
                              size_t size,
                              CoglClipStackType type)
 {
-  CoglClipStack *entry = g_slice_alloc (size);
+  CoglClipStack *entry = g_malloc0 (size);
 
   /* The new entry starts with a ref count of 1 because the stack
      holds a reference to it as it is the top entry */
@@ -341,11 +341,11 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
           {
             CoglClipStackRect *rect = (CoglClipStackRect *) entry;
             cogl_matrix_entry_unref (rect->matrix_entry);
-            g_slice_free1 (sizeof (CoglClipStackRect), entry);
+            g_free (entry);
             break;
           }
         case COGL_CLIP_STACK_WINDOW_RECT:
-          g_slice_free1 (sizeof (CoglClipStackWindowRect), entry);
+          g_free (entry);
           break;
         case COGL_CLIP_STACK_PRIMITIVE:
           {
@@ -353,14 +353,14 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
               (CoglClipStackPrimitive *) entry;
             cogl_matrix_entry_unref (primitive_entry->matrix_entry);
             cogl_object_unref (primitive_entry->primitive);
-            g_slice_free1 (sizeof (CoglClipStackPrimitive), entry);
+            g_free (entry);
             break;
           }
         case COGL_CLIP_STACK_REGION:
           {
             CoglClipStackRegion *region = (CoglClipStackRegion *) entry;
             cairo_region_destroy (region->region);
-            g_slice_free1 (sizeof (CoglClipStackRegion), entry);
+            g_free (entry);
             break;
           }
         default:
diff --git a/cogl/cogl/cogl-closure-list.c b/cogl/cogl/cogl-closure-list.c
index a2e82e796f..1f4efdc683 100644
--- a/cogl/cogl/cogl-closure-list.c
+++ b/cogl/cogl/cogl-closure-list.c
@@ -41,7 +41,7 @@ _cogl_closure_disconnect (CoglClosure *closure)
   if (closure->destroy_cb)
     closure->destroy_cb (closure->user_data);
 
-  g_slice_free (CoglClosure, closure);
+  g_free (closure);
 }
 
 void
@@ -59,7 +59,7 @@ _cogl_closure_list_add (CoglList *list,
                         void *user_data,
                         CoglUserDataDestroyCallback destroy_cb)
 {
-  CoglClosure *closure = g_slice_new (CoglClosure);
+  CoglClosure *closure = g_new0 (CoglClosure, 1);
 
   closure->function = function;
   closure->user_data = user_data;
diff --git a/cogl/cogl/cogl-color.c b/cogl/cogl/cogl-color.c
index 75cf829bd8..16f471c0fd 100644
--- a/cogl/cogl/cogl-color.c
+++ b/cogl/cogl/cogl-color.c
@@ -42,14 +42,14 @@ COGL_GTYPE_DEFINE_BOXED (Color, color, cogl_color_copy, cogl_color_free);
 CoglColor *
 cogl_color_new (void)
 {
-  return g_slice_new (CoglColor);
+  return g_new0 (CoglColor, 1);
 }
 
 CoglColor *
 cogl_color_copy (const CoglColor *color)
 {
   if (G_LIKELY (color))
-    return g_slice_dup (CoglColor, color);
+    return g_memdup2 (color, sizeof (CoglColor));
 
   return NULL;
 }
@@ -58,7 +58,7 @@ void
 cogl_color_free (CoglColor *color)
 {
   if (G_LIKELY (color))
-    g_slice_free (CoglColor, color);
+    g_free (color);
 }
 
 void
diff --git a/cogl/cogl/cogl-display.c b/cogl/cogl/cogl-display.c
index 5394dbf856..ea5383944b 100644
--- a/cogl/cogl/cogl-display.c
+++ b/cogl/cogl/cogl-display.c
@@ -79,14 +79,14 @@ _cogl_display_free (CoglDisplay *display)
       display->onscreen_template = NULL;
     }
 
-  g_slice_free (CoglDisplay, display);
+  g_free (display);
 }
 
 CoglDisplay *
 cogl_display_new (CoglRenderer *renderer,
                   CoglOnscreenTemplate *onscreen_template)
 {
-  CoglDisplay *display = g_slice_new0 (CoglDisplay);
+  CoglDisplay *display = g_new0 (CoglDisplay, 1);
   GError *error = NULL;
 
   _cogl_init ();
diff --git a/cogl/cogl/cogl-fence.c b/cogl/cogl/cogl-fence.c
index ff1a7dfcac..b2fcd148a8 100644
--- a/cogl/cogl/cogl-fence.c
+++ b/cogl/cogl/cogl-fence.c
@@ -164,7 +164,7 @@ cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer,
   if (!COGL_FLAGS_GET (context->features, COGL_FEATURE_ID_FENCE))
     return NULL;
 
-  fence = g_slice_new (CoglFenceClosure);
+  fence = g_new0 (CoglFenceClosure, 1);
   fence->framebuffer = framebuffer;
   fence->callback = callback;
   fence->user_data = user_data;
@@ -209,7 +209,7 @@ cogl_framebuffer_cancel_fence_callback (CoglFramebuffer *framebuffer,
 #endif
     }
 
-  g_slice_free (CoglFenceClosure, fence);
+  g_free (fence);
 }
 
 void
diff --git a/cogl/cogl/cogl-frame-info.c b/cogl/cogl/cogl-frame-info.c
index 9d3420c029..c4547d0866 100644
--- a/cogl/cogl/cogl-frame-info.c
+++ b/cogl/cogl/cogl-frame-info.c
@@ -43,7 +43,7 @@ cogl_frame_info_new (int64_t global_frame_counter)
 {
   CoglFrameInfo *info;
 
-  info = g_slice_new0 (CoglFrameInfo);
+  info = g_new0 (CoglFrameInfo, 1);
   info->global_frame_counter = global_frame_counter;
 
   return _cogl_frame_info_object_new (info);
@@ -52,7 +52,7 @@ cogl_frame_info_new (int64_t global_frame_counter)
 static void
 _cogl_frame_info_free (CoglFrameInfo *info)
 {
-  g_slice_free (CoglFrameInfo, info);
+  g_free (info);
 }
 
 int64_t
diff --git a/cogl/cogl/cogl-index-buffer.c b/cogl/cogl/cogl-index-buffer.c
index 9333a2fef6..2050db3c95 100644
--- a/cogl/cogl/cogl-index-buffer.c
+++ b/cogl/cogl/cogl-index-buffer.c
@@ -50,7 +50,7 @@ COGL_GTYPE_DEFINE_CLASS (IndexBuffer, index_buffer);
 CoglIndexBuffer *
 cogl_index_buffer_new (CoglContext *context, size_t bytes)
 {
-  CoglIndexBuffer *indices = g_slice_new (CoglIndexBuffer);
+  CoglIndexBuffer *indices = g_new0 (CoglIndexBuffer, 1);
 
   /* parent's constructor */
   _cogl_buffer_initialize (COGL_BUFFER (indices),
@@ -69,7 +69,7 @@ _cogl_index_buffer_free (CoglIndexBuffer *indices)
   /* parent's destructor */
   _cogl_buffer_fini (COGL_BUFFER (indices));
 
-  g_slice_free (CoglIndexBuffer, indices);
+  g_free (indices);
 }
 
 /* XXX: do we want a convenience function like this as an alternative
diff --git a/cogl/cogl/cogl-indices.c b/cogl/cogl/cogl-indices.c
index 5fac91a2e8..7613c587fe 100644
--- a/cogl/cogl/cogl-indices.c
+++ b/cogl/cogl/cogl-indices.c
@@ -69,7 +69,7 @@ cogl_indices_new_for_buffer (CoglIndicesType type,
                              CoglIndexBuffer *buffer,
                              size_t offset)
 {
-  CoglIndices *indices = g_slice_new (CoglIndices);
+  CoglIndices *indices = g_new0 (CoglIndices, 1);
 
   indices->buffer = cogl_object_ref (buffer);
   indices->offset = offset;
@@ -161,7 +161,7 @@ static void
 _cogl_indices_free (CoglIndices *indices)
 {
   cogl_object_unref (indices->buffer);
-  g_slice_free (CoglIndices, indices);
+  g_free (indices);
 }
 
 CoglIndices *
diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c
index 23dfb5c34c..26edb4ebf8 100644
--- a/cogl/cogl/cogl-journal.c
+++ b/cogl/cogl/cogl-journal.c
@@ -140,13 +140,13 @@ _cogl_journal_free (CoglJournal *journal)
     if (journal->vbo_pool[i])
       cogl_object_unref (journal->vbo_pool[i]);
 
-  g_slice_free (CoglJournal, journal);
+  g_free (journal);
 }
 
 CoglJournal *
 _cogl_journal_new (CoglFramebuffer *framebuffer)
 {
-  CoglJournal *journal = g_slice_new0 (CoglJournal);
+  CoglJournal *journal = g_new0 (CoglJournal, 1);
 
   journal->framebuffer = framebuffer;
   journal->entries = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
diff --git a/cogl/cogl/cogl-matrix-stack.c b/cogl/cogl/cogl-matrix-stack.c
index 4e132baf5c..47afa43ec2 100644
--- a/cogl/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl/cogl-matrix-stack.c
@@ -513,13 +513,13 @@ static void
 _cogl_matrix_stack_free (CoglMatrixStack *stack)
 {
   cogl_matrix_entry_unref (stack->last_entry);
-  g_slice_free (CoglMatrixStack, stack);
+  g_free (stack);
 }
 
 CoglMatrixStack *
 cogl_matrix_stack_new (CoglContext *ctx)
 {
-  CoglMatrixStack *stack = g_slice_new (CoglMatrixStack);
+  CoglMatrixStack *stack = g_new0 (CoglMatrixStack, 1);
 
   if (G_UNLIKELY (cogl_matrix_stack_magazine == NULL))
     {
diff --git a/cogl/cogl/cogl-memory-stack.c b/cogl/cogl/cogl-memory-stack.c
index 65b45df605..2ea6e8f88e 100644
--- a/cogl/cogl/cogl-memory-stack.c
+++ b/cogl/cogl/cogl-memory-stack.c
@@ -81,7 +81,7 @@ struct _CoglMemoryStack
 static CoglMemorySubStack *
 _cogl_memory_sub_stack_alloc (size_t bytes)
 {
-  CoglMemorySubStack *sub_stack = g_slice_new (CoglMemorySubStack);
+  CoglMemorySubStack *sub_stack = g_new0 (CoglMemorySubStack, 1);
   sub_stack->bytes = bytes;
   sub_stack->data = g_malloc (bytes);
   return sub_stack;
@@ -101,7 +101,7 @@ _cogl_memory_stack_add_sub_stack (CoglMemoryStack *stack,
 CoglMemoryStack *
 _cogl_memory_stack_new (size_t initial_size_bytes)
 {
-  CoglMemoryStack *stack = g_slice_new0 (CoglMemoryStack);
+  CoglMemoryStack *stack = g_new0 (CoglMemoryStack, 1);
 
   _cogl_list_init (&stack->sub_stacks);
 
@@ -175,7 +175,7 @@ static void
 _cogl_memory_sub_stack_free (CoglMemorySubStack *sub_stack)
 {
   g_free (sub_stack->data);
-  g_slice_free (CoglMemorySubStack, sub_stack);
+  g_free (sub_stack);
 }
 
 void
@@ -190,5 +190,5 @@ _cogl_memory_stack_free (CoglMemoryStack *stack)
       _cogl_memory_sub_stack_free (sub_stack);
     }
 
-  g_slice_free (CoglMemoryStack, stack);
+  g_free (stack);
 }
diff --git a/cogl/cogl/cogl-onscreen-template.c b/cogl/cogl/cogl-onscreen-template.c
index 2444707390..59fa1af18f 100644
--- a/cogl/cogl/cogl-onscreen-template.c
+++ b/cogl/cogl/cogl-onscreen-template.c
@@ -47,13 +47,13 @@ COGL_GTYPE_DEFINE_CLASS (OnscreenTemplate, onscreen_template);
 static void
 _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template)
 {
-  g_slice_free (CoglOnscreenTemplate, onscreen_template);
+  g_free (onscreen_template);
 }
 
 CoglOnscreenTemplate *
 cogl_onscreen_template_new (CoglSwapChain *swap_chain)
 {
-  CoglOnscreenTemplate *onscreen_template = g_slice_new0 (CoglOnscreenTemplate);
+  CoglOnscreenTemplate *onscreen_template = g_new0 (CoglOnscreenTemplate, 1);
   char *user_config;
 
   onscreen_template->config.swap_chain = swap_chain;
diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c
index 6aefd531c1..8bc3d2607e 100644
--- a/cogl/cogl/cogl-onscreen.c
+++ b/cogl/cogl/cogl-onscreen.c
@@ -204,7 +204,7 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
       g_object_unref (onscreen);
       cogl_object_unref (info);
 
-      g_slice_free (CoglOnscreenEvent, event);
+      g_free (event);
     }
 
   while (!_cogl_list_empty (&context->onscreen_dirty_queue))
@@ -225,7 +225,7 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
 
       g_object_unref (qe->onscreen);
 
-      g_slice_free (CoglOnscreenQueuedDirty, qe);
+      g_free (qe);
     }
 }
 
@@ -252,7 +252,7 @@ _cogl_onscreen_queue_dirty (CoglOnscreen *onscreen,
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
-  CoglOnscreenQueuedDirty *qe = g_slice_new (CoglOnscreenQueuedDirty);
+  CoglOnscreenQueuedDirty *qe = g_new0 (CoglOnscreenQueuedDirty, 1);
 
   qe->onscreen = g_object_ref (onscreen);
   qe->info = *info;
@@ -283,7 +283,7 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen,
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
 
-  CoglOnscreenEvent *event = g_slice_new (CoglOnscreenEvent);
+  CoglOnscreenEvent *event = g_new0 (CoglOnscreenEvent, 1);
 
   event->onscreen = g_object_ref (onscreen);
   event->info = cogl_object_ref (info);
diff --git a/cogl/cogl/cogl-output.c b/cogl/cogl/cogl-output.c
index e2c005076a..5ad0e40220 100644
--- a/cogl/cogl/cogl-output.c
+++ b/cogl/cogl/cogl-output.c
@@ -45,7 +45,7 @@ _cogl_output_new (const char *name)
 {
   CoglOutput *output;
 
-  output = g_slice_new0 (CoglOutput);
+  output = g_new0 (CoglOutput, 1);
   output->name = g_strdup (name);
 
   return _cogl_output_object_new (output);
@@ -56,7 +56,7 @@ _cogl_output_free (CoglOutput *output)
 {
   g_free (output->name);
 
-  g_slice_free (CoglOutput, output);
+  g_free (output);
 }
 
 gboolean
diff --git a/cogl/cogl/cogl-pipeline-hash-table.c b/cogl/cogl/cogl-pipeline-hash-table.c
index 1e4bc17844..53df22d28d 100644
--- a/cogl/cogl/cogl-pipeline-hash-table.c
+++ b/cogl/cogl/cogl-pipeline-hash-table.c
@@ -66,7 +66,7 @@ value_destroy_cb (void *value)
 
   cogl_object_unref (entry->parent.pipeline);
 
-  g_slice_free (CoglPipelineHashTableEntry, entry);
+  g_free (entry);
 }
 
 static unsigned int
@@ -206,7 +206,7 @@ _cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash,
   if (g_hash_table_size (hash->table) >= hash->expected_min_size * 2)
     prune_old_pipelines (hash);
 
-  entry = g_slice_new (CoglPipelineHashTableEntry);
+  entry = g_new0 (CoglPipelineHashTableEntry, 1);
   entry->parent.usage_count = 0;
   entry->hash = hash;
   entry->hash_value = dummy_entry.hash_value;
diff --git a/cogl/cogl/cogl-pipeline-layer.c b/cogl/cogl/cogl-pipeline-layer.c
index 32133352a4..698f7f14ac 100644
--- a/cogl/cogl/cogl-pipeline-layer.c
+++ b/cogl/cogl/cogl-pipeline-layer.c
@@ -161,7 +161,7 @@ _cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest,
   if ((differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE) &&
       !dest->has_big_state)
     {
-      dest->big_state = g_slice_new (CoglPipelineLayerBigState);
+      dest->big_state = g_new0 (CoglPipelineLayerBigState, 1);
       dest->has_big_state = TRUE;
     }
 
@@ -408,7 +408,7 @@ init_layer_state:
   if (change & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE &&
       !layer->has_big_state)
     {
-      layer->big_state = g_slice_new (CoglPipelineLayerBigState);
+      layer->big_state = g_new0 (CoglPipelineLayerBigState, 1);
       layer->has_big_state = TRUE;
     }
 
@@ -457,7 +457,7 @@ _cogl_pipeline_layer_set_parent (CoglPipelineLayer *layer,
 CoglPipelineLayer *
 _cogl_pipeline_layer_copy (CoglPipelineLayer *src)
 {
-  CoglPipelineLayer *layer = g_slice_new (CoglPipelineLayer);
+  CoglPipelineLayer *layer = g_new0 (CoglPipelineLayer, 1);
 
   _cogl_pipeline_node_init (COGL_NODE (layer));
 
@@ -712,17 +712,17 @@ _cogl_pipeline_layer_free (CoglPipelineLayer *layer)
     _cogl_pipeline_snippet_list_free (&layer->big_state->fragment_snippets);
 
   if (layer->differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE)
-    g_slice_free (CoglPipelineLayerBigState, layer->big_state);
+    g_free (layer->big_state);
 
-  g_slice_free (CoglPipelineLayer, layer);
+  g_free (layer);
 }
 
 void
 _cogl_pipeline_init_default_layers (void)
 {
-  CoglPipelineLayer *layer = g_slice_new0 (CoglPipelineLayer);
+  CoglPipelineLayer *layer = g_new0 (CoglPipelineLayer, 1);
   CoglPipelineLayerBigState *big_state =
-    g_slice_new0 (CoglPipelineLayerBigState);
+    g_new0 (CoglPipelineLayerBigState, 1);
   CoglPipelineLayer *new;
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h
index b62c928566..045af8fa01 100644
--- a/cogl/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl/cogl-pipeline-private.h
@@ -635,7 +635,7 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
  * static void
  * destroy_cache_cb (CoglObject *object, void *user_data)
  * {
- *   g_slice_free (MyValidatedMaterialCache, user_data);
+ *   g_free (user_data);
  * }
  *
  * static void
@@ -654,7 +654,7 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
  *                                &_cogl_my_cache_key);
  *   if (G_UNLIKELY (cache == NULL))
  *     {
- *       cache = g_slice_new (MyValidatedMaterialCache);
+ *       cache = g_new0 (MyValidatedMaterialCache, 1);
  *       cogl_object_set_user_data (COGL_OBJECT (source),
  *                                  &_cogl_my_cache_key,
  *                                  cache, destroy_cache_cb);
diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index 27947adc82..90499ce5e2 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -80,10 +80,10 @@ void
 _cogl_pipeline_init_default_pipeline (void)
 {
   /* Create new - blank - pipeline */
-  CoglPipeline *pipeline = g_slice_new0 (CoglPipeline);
+  CoglPipeline *pipeline = g_new0 (CoglPipeline, 1);
   /* XXX: NB: It's important that we zero this to avoid polluting
    * pipeline hash values with un-initialized data */
-  CoglPipelineBigState *big_state = g_slice_new0 (CoglPipelineBigState);
+  CoglPipelineBigState *big_state = g_new0 (CoglPipelineBigState, 1);
   CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
   CoglPipelineBlendState *blend_state = &big_state->blend_state;
   CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state;
@@ -180,8 +180,7 @@ recursively_free_layer_caches (CoglPipeline *pipeline)
     return;
 
   if (G_UNLIKELY (pipeline->layers_cache != pipeline->short_layers_cache))
-    g_slice_free1 (sizeof (CoglPipelineLayer *) * pipeline->n_layers,
-                   pipeline->layers_cache);
+    g_free (pipeline->layers_cache);
   pipeline->layers_cache_dirty = TRUE;
 
   _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline),
@@ -254,7 +253,7 @@ _cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong)
 static CoglPipeline *
 _cogl_pipeline_copy (CoglPipeline *src, gboolean is_weak)
 {
-  CoglPipeline *pipeline = g_slice_new (CoglPipeline);
+  CoglPipeline *pipeline = g_new0 (CoglPipeline, 1);
 
   _cogl_pipeline_node_init (COGL_NODE (pipeline));
 
@@ -393,11 +392,11 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
     _cogl_pipeline_snippet_list_free (&pipeline->big_state->fragment_snippets);
 
   if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE)
-    g_slice_free (CoglPipelineBigState, pipeline->big_state);
+    g_free (pipeline->big_state);
 
   recursively_free_layer_caches (pipeline);
 
-  g_slice_free (CoglPipeline, pipeline);
+  g_free (pipeline);
 }
 
 gboolean
@@ -433,7 +432,7 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
   else
     {
       pipeline->layers_cache =
-        g_slice_alloc0 (sizeof (CoglPipelineLayer *) * n_layers);
+        g_malloc0 (sizeof (CoglPipelineLayer *) * n_layers);
     }
 
   /* Notes:
@@ -838,7 +837,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
     {
       if (!dest->has_big_state)
         {
-          dest->big_state = g_slice_new (CoglPipelineBigState);
+          dest->big_state = g_new0 (CoglPipelineBigState, 1);
           dest->has_big_state = TRUE;
         }
       big_state = dest->big_state;
@@ -1220,7 +1219,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline     *pipeline,
   if (change & COGL_PIPELINE_STATE_NEEDS_BIG_STATE &&
       !pipeline->has_big_state)
     {
-      pipeline->big_state = g_slice_new (CoglPipelineBigState);
+      pipeline->big_state = g_new0 (CoglPipelineBigState, 1);
       pipeline->has_big_state = TRUE;
     }
 
diff --git a/cogl/cogl/cogl-pixel-buffer.c b/cogl/cogl/cogl-pixel-buffer.c
index d7d3839715..f7dc0c70cf 100644
--- a/cogl/cogl/cogl-pixel-buffer.c
+++ b/cogl/cogl/cogl-pixel-buffer.c
@@ -63,7 +63,7 @@ _cogl_pixel_buffer_new (CoglContext *context,
                         const void *data,
                         GError **error)
 {
-  CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
+  CoglPixelBuffer *pixel_buffer = g_new0 (CoglPixelBuffer, 1);
   CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
 
   /* parent's constructor */
@@ -111,6 +111,6 @@ _cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
   /* parent's destructor */
   _cogl_buffer_fini (COGL_BUFFER (buffer));
 
-  g_slice_free (CoglPixelBuffer, buffer);
+  g_free (buffer);
 }
 
diff --git a/cogl/cogl/cogl-poll.c b/cogl/cogl/cogl-poll.c
index c736e48b38..f9818a8111 100644
--- a/cogl/cogl/cogl-poll.c
+++ b/cogl/cogl/cogl-poll.c
@@ -162,7 +162,7 @@ _cogl_poll_renderer_remove_fd (CoglRenderer *renderer, int fd)
         {
           renderer->poll_sources =
             g_list_delete_link (renderer->poll_sources, l);
-          g_slice_free (CoglPollSource, source);
+          g_free (source);
           break;
         }
     }
@@ -203,7 +203,7 @@ _cogl_poll_renderer_add_fd (CoglRenderer *renderer,
 
   _cogl_poll_renderer_remove_fd (renderer, fd);
 
-  source = g_slice_new0 (CoglPollSource);
+  source = g_new0 (CoglPollSource, 1);
   source->fd = fd;
   source->prepare = prepare;
   source->dispatch = dispatch;
@@ -223,7 +223,7 @@ _cogl_poll_renderer_add_source (CoglRenderer *renderer,
 {
   CoglPollSource *source;
 
-  source = g_slice_new0 (CoglPollSource);
+  source = g_new0 (CoglPollSource, 1);
   source->fd = -1;
   source->prepare = prepare;
   source->dispatch = dispatch;
@@ -246,7 +246,7 @@ _cogl_poll_renderer_remove_source (CoglRenderer *renderer,
         {
           renderer->poll_sources =
             g_list_delete_link (renderer->poll_sources, l);
-          g_slice_free (CoglPollSource, source);
+          g_free (source);
           break;
         }
     }
diff --git a/cogl/cogl/cogl-primitive.c b/cogl/cogl/cogl-primitive.c
index 01654584e8..7da4a3fa96 100644
--- a/cogl/cogl/cogl-primitive.c
+++ b/cogl/cogl/cogl-primitive.c
@@ -58,8 +58,8 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
   CoglPrimitive *primitive;
   int i;
 
-  primitive = g_slice_alloc (sizeof (CoglPrimitive) +
-                             sizeof (CoglAttribute *) * (n_attributes - 1));
+  primitive = g_malloc0 (sizeof (CoglPrimitive) +
+                         sizeof (CoglAttribute *) * (n_attributes - 1));
   primitive->mode = mode;
   primitive->first_vertex = 0;
   primitive->n_vertices = n_vertices;
@@ -384,15 +384,12 @@ _cogl_primitive_free (CoglPrimitive *primitive)
     cogl_object_unref (primitive->attributes[i]);
 
   if (primitive->attributes != &primitive->embedded_attribute)
-    g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
-                   primitive->attributes);
+    g_free (primitive->attributes);
 
   if (primitive->indices)
     cogl_object_unref (primitive->indices);
 
-  g_slice_free1 (sizeof (CoglPrimitive) +
-                 sizeof (CoglAttribute *) *
-                 (primitive->n_embedded_attributes - 1), primitive);
+  g_free (primitive);
 }
 
 static void
@@ -441,17 +438,15 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
   if (n_attributes <= primitive->n_embedded_attributes)
     {
       if (primitive->attributes != &primitive->embedded_attribute)
-        g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
-                       primitive->attributes);
+        g_free (primitive->attributes);
       primitive->attributes = &primitive->embedded_attribute;
     }
   else
     {
       if (primitive->attributes != &primitive->embedded_attribute)
-        g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
-                       primitive->attributes);
+        g_free (primitive->attributes);
       primitive->attributes =
-        g_slice_alloc (sizeof (CoglAttribute *) * n_attributes);
+        g_malloc0 (sizeof (CoglAttribute *) * n_attributes);
     }
 
   memcpy (primitive->attributes, attributes,
diff --git a/cogl/cogl/cogl-rectangle-map.c b/cogl/cogl/cogl-rectangle-map.c
index b966d802e9..6285c8a7aa 100644
--- a/cogl/cogl/cogl-rectangle-map.c
+++ b/cogl/cogl/cogl-rectangle-map.c
@@ -121,13 +121,13 @@ struct _CoglRectangleMapStackEntry
 static CoglRectangleMapNode *
 _cogl_rectangle_map_node_new (void)
 {
-  return g_slice_new (CoglRectangleMapNode);
+  return g_new0 (CoglRectangleMapNode, 1);
 }
 
 static void
 _cogl_rectangle_map_node_free (CoglRectangleMapNode *node)
 {
-  g_slice_free (CoglRectangleMapNode, node);
+  g_free (node);
 }
 
 CoglRectangleMap *
diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c
index b0386fa51e..199dd175e9 100644
--- a/cogl/cogl/cogl-renderer.c
+++ b/cogl/cogl/cogl-renderer.c
@@ -164,7 +164,7 @@ _cogl_renderer_get_winsys (CoglRenderer *renderer)
 static void
 native_filter_closure_free (CoglNativeFilterClosure *closure)
 {
-  g_slice_free (CoglNativeFilterClosure, closure);
+  g_free (closure);
 }
 
 static void
@@ -652,7 +652,7 @@ _cogl_renderer_add_native_filter (CoglRenderer *renderer,
 {
   CoglNativeFilterClosure *closure;
 
-  closure = g_slice_new (CoglNativeFilterClosure);
+  closure = g_new0 (CoglNativeFilterClosure, 1);
   closure->func = func;
   closure->data = data;
 
diff --git a/cogl/cogl/cogl-sampler-cache.c b/cogl/cogl/cogl-sampler-cache.c
index 2e0e761f00..9ec3160b65 100644
--- a/cogl/cogl/cogl-sampler-cache.c
+++ b/cogl/cogl/cogl-sampler-cache.c
@@ -181,7 +181,7 @@ _cogl_sampler_cache_get_entry_gl (CoglSamplerCache *cache,
 
   if (entry == NULL)
     {
-      entry = g_slice_dup (CoglSamplerCacheEntry, key);
+      entry = g_memdup2 (key, sizeof (CoglSamplerCacheEntry));
 
       cache->context->driver_vtable->sampler_init (cache->context, entry);
 
@@ -204,7 +204,7 @@ _cogl_sampler_cache_get_entry_cogl (CoglSamplerCache *cache,
       CoglSamplerCacheEntry canonical_key;
       CoglSamplerCacheEntry *gl_entry;
 
-      entry = g_slice_dup (CoglSamplerCacheEntry, key);
+      entry = g_memdup2 (key, sizeof (CoglSamplerCacheEntry));
 
       /* Get the sampler object number from the canonical GL version
          of the sampler state cache */
@@ -271,7 +271,7 @@ hash_table_free_gl_cb (void *key,
 
   context->driver_vtable->sampler_free (context, entry);
 
-  g_slice_free (CoglSamplerCacheEntry, entry);
+  g_free (entry);
 }
 
 static void
@@ -281,7 +281,7 @@ hash_table_free_cogl_cb (void *key,
 {
   CoglSamplerCacheEntry *entry = value;
 
-  g_slice_free (CoglSamplerCacheEntry, entry);
+  g_free (entry);
 }
 
 void
diff --git a/cogl/cogl/cogl-snippet.c b/cogl/cogl/cogl-snippet.c
index 9b5ed7c232..d232a14f90 100644
--- a/cogl/cogl/cogl-snippet.c
+++ b/cogl/cogl/cogl-snippet.c
@@ -49,7 +49,7 @@ cogl_snippet_new (CoglSnippetHook hook,
                   const char *declarations,
                   const char *post)
 {
-  CoglSnippet *snippet = g_slice_new0 (CoglSnippet);
+  CoglSnippet *snippet = g_new0 (CoglSnippet, 1);
 
   _cogl_snippet_object_new (snippet);
 
@@ -181,5 +181,5 @@ _cogl_snippet_free (CoglSnippet *snippet)
   g_free (snippet->pre);
   g_free (snippet->replace);
   g_free (snippet->post);
-  g_slice_free (CoglSnippet, snippet);
+  g_free (snippet);
 }
diff --git a/cogl/cogl/cogl-swap-chain.c b/cogl/cogl/cogl-swap-chain.c
index a01f2d4db3..fdb3c4d6c5 100644
--- a/cogl/cogl/cogl-swap-chain.c
+++ b/cogl/cogl/cogl-swap-chain.c
@@ -46,13 +46,13 @@ COGL_GTYPE_DEFINE_CLASS (SwapChain, swap_chain);
 static void
 _cogl_swap_chain_free (CoglSwapChain *swap_chain)
 {
-  g_slice_free (CoglSwapChain, swap_chain);
+  g_free (swap_chain);
 }
 
 CoglSwapChain *
 cogl_swap_chain_new (void)
 {
-  CoglSwapChain *swap_chain = g_slice_new0 (CoglSwapChain);
+  CoglSwapChain *swap_chain = g_new0 (CoglSwapChain, 1);
 
   swap_chain->length = -1; /* no preference */
 
diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c
index 866a0b584f..0206caac3d 100644
--- a/cogl/cogl/cogl-texture.c
+++ b/cogl/cogl/cogl-texture.c
@@ -155,7 +155,7 @@ _cogl_texture_free_loader (CoglTexture *texture)
           cogl_object_unref (loader->src.bitmap.bitmap);
           break;
         }
-      g_slice_free (CoglTextureLoader, loader);
+      g_free (loader);
       texture->loader = NULL;
     }
 }
@@ -163,7 +163,7 @@ _cogl_texture_free_loader (CoglTexture *texture)
 CoglTextureLoader *
 _cogl_texture_create_loader (void)
 {
-  return g_slice_new0 (CoglTextureLoader);
+  return g_new0 (CoglTextureLoader, 1);
 }
 
 void
diff --git a/cogl/cogl/cogl-xlib-renderer.c b/cogl/cogl/cogl-xlib-renderer.c
index 9ee9d6a47b..163fb32b5d 100644
--- a/cogl/cogl/cogl-xlib-renderer.c
+++ b/cogl/cogl/cogl-xlib-renderer.c
@@ -58,7 +58,7 @@ _xlib_renderer_data_free (CoglXlibRenderer *data)
   if (data->xvisinfo)
     XFree (data->xvisinfo);
 
-  g_slice_free (CoglXlibRenderer, data);
+  g_free (data);
 }
 
 CoglXlibRenderer *
@@ -71,7 +71,7 @@ _cogl_xlib_renderer_get_data (CoglRenderer *renderer)
      data. */
 
   if (!renderer->custom_winsys_user_data)
-    renderer->custom_winsys_user_data = g_slice_new0 (CoglXlibRenderer);
+    renderer->custom_winsys_user_data = g_new0 (CoglXlibRenderer, 1);
 
   return renderer->custom_winsys_user_data;
 }
diff --git a/cogl/cogl/deprecated/cogl-program.c b/cogl/cogl/deprecated/cogl-program.c
index 65904c6b5d..fe75e8e68b 100644
--- a/cogl/cogl/deprecated/cogl-program.c
+++ b/cogl/cogl/deprecated/cogl-program.c
@@ -73,7 +73,7 @@ _cogl_program_free (CoglProgram *program)
 
   g_array_free (program->custom_uniforms, TRUE);
 
-  g_slice_free (CoglProgram, program);
+  g_free (program);
 }
 
 CoglHandle
@@ -81,7 +81,7 @@ cogl_create_program (void)
 {
   CoglProgram *program;
 
-  program = g_slice_new0 (CoglProgram);
+  program = g_new0 (CoglProgram, 1);
 
   program->custom_uniforms =
     g_array_new (FALSE, FALSE, sizeof (CoglProgramUniform));
diff --git a/cogl/cogl/deprecated/cogl-shader.c b/cogl/cogl/deprecated/cogl-shader.c
index ec899ce34f..fb1b7ae281 100644
--- a/cogl/cogl/deprecated/cogl-shader.c
+++ b/cogl/cogl/deprecated/cogl-shader.c
@@ -54,7 +54,7 @@ _cogl_shader_free (CoglShader *shader)
     if (shader->gl_handle)
       GE (ctx, glDeleteShader (shader->gl_handle));
 
-  g_slice_free (CoglShader, shader);
+  g_free (shader);
 }
 
 CoglHandle
@@ -75,7 +75,7 @@ cogl_create_shader (CoglShaderType type)
       return NULL;
     }
 
-  shader = g_slice_new (CoglShader);
+  shader = g_new0 (CoglShader, 1);
   shader->gl_handle = 0;
   shader->compilation_pipeline = NULL;
   shader->type = type;
diff --git a/cogl/cogl/driver/gl/cogl-attribute-gl.c b/cogl/cogl/driver/gl/cogl-attribute-gl.c
index 3475569ffa..d619e286f0 100644
--- a/cogl/cogl/driver/gl/cogl-attribute-gl.c
+++ b/cogl/cogl/driver/gl/cogl-attribute-gl.c
@@ -232,13 +232,13 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer,
        *                 sizeof (options) != 0)
        *       {
        *         cogl_object_unref (overrides->weak_pipeline);
-       *         g_slice_free (Overrides, overrides);
+       *         g_free (overrides);
        *         overrides = NULL;
        *       }
        *   }
        * if (!overrides)
        *   {
-       *     overrides = g_slice_new (Overrides);
+       *     overrides = g_new0 (Overrides, 1);
        *     overrides->weak_pipeline =
        *       cogl_pipeline_weak_copy (pipeline);
        *     _cogl_pipeline_apply_overrides (overrides->weak_pipeline,
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c 
b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
index 42986c3067..d932a5cf56 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
@@ -113,7 +113,7 @@ shader_state_new (int n_layers,
 {
   CoglPipelineShaderState *shader_state;
 
-  shader_state = g_slice_new0 (CoglPipelineShaderState);
+  shader_state = g_new0 (CoglPipelineShaderState, 1);
   shader_state->ref_count = 1;
   shader_state->unit_state = g_new0 (UnitState, n_layers);
   shader_state->cache_entry = cache_entry;
@@ -146,7 +146,7 @@ destroy_shader_state (void *user_data,
 
       g_free (shader_state->unit_state);
 
-      g_slice_free (CoglPipelineShaderState, shader_state);
+      g_free (shader_state);
     }
 }
 
@@ -869,7 +869,7 @@ ensure_layer_generated (CoglPipeline *pipeline,
                           layer_index,
                           layer_index);
 
-  g_slice_free (LayerData, layer_data);
+  g_free (layer_data);
 }
 
 static gboolean
@@ -884,7 +884,7 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
     return TRUE;
 
   /* Store the layers in reverse order */
-  layer_data = g_slice_new (LayerData);
+  layer_data = g_new0 (LayerData, 1);
   layer_data->layer = layer;
 
   if (_cogl_list_empty (&shader_state->layers))
@@ -1016,7 +1016,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
                                     tmp,
                                     &shader_state->layers,
                                     link)
-            g_slice_free (LayerData, layer_data);
+            g_free (layer_data);
         }
       else
         g_string_append (shader_state->source,
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c 
b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c
index c2614d2d20..9d94f12ce3 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c
@@ -231,7 +231,7 @@ program_state_new (int n_layers,
 {
   CoglPipelineProgramState *program_state;
 
-  program_state = g_slice_new (CoglPipelineProgramState);
+  program_state = g_new0 (CoglPipelineProgramState, 1);
   program_state->ref_count = 1;
   program_state->program = 0;
   program_state->unit_state = g_new (UnitState, n_layers);
@@ -278,7 +278,7 @@ destroy_program_state (void *user_data,
       if (program_state->uniform_locations)
         g_array_free (program_state->uniform_locations, TRUE);
 
-      g_slice_free (CoglPipelineProgramState, program_state);
+      g_free (program_state);
     }
 }
 
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c 
b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
index 7ef7a49937..28b5d5d76d 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
@@ -68,7 +68,7 @@ shader_state_new (CoglPipelineCacheEntry *cache_entry)
 {
   CoglPipelineShaderState *shader_state;
 
-  shader_state = g_slice_new0 (CoglPipelineShaderState);
+  shader_state = g_new0 (CoglPipelineShaderState, 1);
   shader_state->ref_count = 1;
   shader_state->cache_entry = cache_entry;
 
@@ -98,7 +98,7 @@ destroy_shader_state (void *user_data,
       if (shader_state->gl_shader)
         GE( ctx, glDeleteShader (shader_state->gl_shader) );
 
-      g_slice_free (CoglPipelineShaderState, shader_state);
+      g_free (shader_state);
     }
 }
 
diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
index e972bde50c..2c8141fae8 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
@@ -193,7 +193,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 
   eglTerminate (egl_renderer->edpy);
 
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  g_free (egl_renderer);
 }
 
 static EGLDisplay
@@ -236,7 +236,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   CoglRendererEGL *egl_renderer;
   CoglXlibRenderer *xlib_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = g_new0 (CoglRendererEGL, 1);
   egl_renderer = renderer->winsys;
   xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
 
@@ -303,7 +303,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglDisplayEGL *egl_display = display->winsys;
   CoglDisplayXlib *xlib_display;
 
-  xlib_display = g_slice_new0 (CoglDisplayXlib);
+  xlib_display = g_new0 (CoglDisplayXlib, 1);
   egl_display->platform = xlib_display;
 
   return TRUE;
@@ -314,7 +314,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
 {
   CoglDisplayEGL *egl_display = display->winsys;
 
-  g_slice_free (CoglDisplayXlib, egl_display->platform);
+  g_free (egl_display->platform);
 }
 
 static gboolean
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c
index 6e66041fa9..ed47f5aa56 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
@@ -481,7 +481,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
   if (egl_renderer->platform_vtable->display_destroy)
     egl_renderer->platform_vtable->display_destroy (display);
 
-  g_slice_free (CoglDisplayEGL, display->winsys);
+  g_free (display->winsys);
   display->winsys = NULL;
 }
 
@@ -495,7 +495,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   g_return_val_if_fail (display->winsys == NULL, FALSE);
 
-  egl_display = g_slice_new0 (CoglDisplayEGL);
+  egl_display = g_new0 (CoglDisplayEGL, 1);
   display->winsys = egl_display;
 
 #ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c
index 3e90b6ec6f..bf0acffc9d 100644
--- a/cogl/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/cogl/winsys/cogl-winsys-glx.c
@@ -307,7 +307,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
   if (glx_renderer->libgl_module)
     g_module_close (glx_renderer->libgl_module);
 
-  g_slice_free (CoglGLXRenderer, renderer->winsys);
+  g_free (renderer->winsys);
 }
 
 static gboolean
@@ -440,7 +440,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   CoglGLXRenderer *glx_renderer;
   CoglXlibRenderer *xlib_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglGLXRenderer);
+  renderer->winsys = g_new0 (CoglGLXRenderer, 1);
 
   glx_renderer = renderer->winsys;
   xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
@@ -879,7 +879,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
       glx_display->dummy_xwin = None;
     }
 
-  g_slice_free (CoglGLXDisplay, display->winsys);
+  g_free (display->winsys);
   display->winsys = NULL;
 }
 
@@ -892,7 +892,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   g_return_val_if_fail (display->winsys == NULL, FALSE);
 
-  glx_display = g_slice_new0 (CoglGLXDisplay);
+  glx_display = g_new0 (CoglGLXDisplay, 1);
   display->winsys = glx_display;
 
   if (!create_context (display, error))


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