[gnome-shell/wip/nielsdg/cleanup-cogl-error] Drop CoglError for GError



commit 43cc9c08efc1bf6f5d440b58aa6e3f67cf2fa5b7
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Thu Jun 20 10:12:16 2019 +0200

    Drop CoglError for GError
    
    From https://gitlab.gnome.org/GNOME/mutter/merge_requests/631
    
    ```
    CoglError was added at a certain point to remove the hard dependency on
    GLib, but since this can't be avoided inside mutter, let's remove this
    whole abstraction.
    ```
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/586

 src/st/st-private.c               |  8 ++++----
 src/st/st-theme-node-drawing.c    | 15 ++++++---------
 src/st/st-theme-node-transition.c |  6 +++---
 3 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index c5add4b1d..a9ca90644 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -362,7 +362,7 @@ _st_create_shadow_pipeline (StShadow    *shadow_spec,
 {
   ClutterBackend *backend = clutter_get_default_backend ();
   CoglContext *ctx = clutter_backend_get_cogl_context (backend);
-  CoglError *error = NULL;
+  GError *error = NULL;
 
   static CoglPipeline *shadow_pipeline_template = NULL;
 
@@ -398,7 +398,7 @@ _st_create_shadow_pipeline (StShadow    *shadow_spec,
   if (error)
     {
       g_warning ("Failed to allocate texture: %s", error->message);
-      cogl_error_free (error);
+      g_error_free (error);
     }
 
   g_free (pixels_out);
@@ -466,7 +466,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       CoglFramebuffer *fb;
       CoglContext *ctx;
       CoglColor clear_color;
-      CoglError *catch_error = NULL;
+      GError *catch_error = NULL;
       float x, y;
 
       ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
@@ -480,7 +480,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
 
       if (!cogl_framebuffer_allocate (fb, &catch_error))
         {
-          cogl_error_free (catch_error);
+          g_error_free (catch_error);
           cogl_object_unref (offscreen);
           cogl_object_unref (buffer);
           return NULL;
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index 9877afdae..9e85c99eb 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -72,7 +72,7 @@ create_corner_material (StCornerSpec *corner)
 {
   ClutterBackend *backend = clutter_get_default_backend ();
   CoglContext *ctx = clutter_backend_get_cogl_context (backend);
-  CoglError *error = NULL;
+  GError *error = NULL;
   CoglTexture *texture;
   cairo_t *cr;
   cairo_surface_t *surface;
@@ -184,7 +184,7 @@ create_corner_material (StCornerSpec *corner)
   if (error)
     {
       g_warning ("Failed to allocate texture: %s", error->message);
-      cogl_error_free (error);
+      g_error_free (error);
     }
 
   g_free (data);
@@ -1007,7 +1007,7 @@ st_theme_node_prerender_background (StThemeNode *node,
 {
   ClutterBackend *backend = clutter_get_default_backend ();
   CoglContext *ctx = clutter_backend_get_cogl_context (backend);
-  CoglError *error = NULL;
+  GError *error = NULL;
   StBorderImage *border_image;
   CoglTexture *texture;
   guint radius[4];
@@ -1344,7 +1344,7 @@ st_theme_node_prerender_background (StThemeNode *node,
   if (error)
     {
       g_warning ("Failed to allocate texture: %s", error->message);
-      cogl_error_free (error);
+      g_error_free (error);
     }
 
   cairo_destroy (cr);
@@ -2288,7 +2288,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
   int fb_width, fb_height;
   CoglTexture *buffer;
   CoglFramebuffer *offscreen = NULL;
-  CoglError *error = NULL;
+  GError *error = NULL;
 
   ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
 
@@ -2351,11 +2351,8 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
       state->box_shadow_pipeline = _st_create_shadow_pipeline (st_theme_node_get_box_shadow (node),
                                                                buffer, state->resource_scale);
     }
-  else
-    {
-      cogl_error_free (error);
-    }
 
+  cogl_clear_error (&error);
   cogl_clear_object (&offscreen);
   cogl_clear_object (&buffer);
 }
diff --git a/src/st/st-theme-node-transition.c b/src/st/st-theme-node-transition.c
index 7c3807711..f35977a18 100644
--- a/src/st/st-theme-node-transition.c
+++ b/src/st/st-theme-node-transition.c
@@ -249,7 +249,7 @@ setup_framebuffers (StThemeNodeTransition *transition,
   StThemeNodeTransitionPrivate *priv = transition->priv;
   CoglContext *ctx;
   guint width, height;
-  CoglError *catch_error = NULL;
+  GError *catch_error = NULL;
 
   /* template material to avoid unnecessary shader compilation */
   static CoglPipeline *material_template = NULL;
@@ -277,7 +277,7 @@ setup_framebuffers (StThemeNodeTransition *transition,
   priv->old_offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (priv->old_texture));
   if (!cogl_framebuffer_allocate (priv->old_offscreen, &catch_error))
     {
-      cogl_error_free (catch_error);
+      g_error_free (catch_error);
       cogl_clear_object (&priv->old_offscreen);
       return FALSE;
     }
@@ -286,7 +286,7 @@ setup_framebuffers (StThemeNodeTransition *transition,
   priv->new_offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (priv->new_texture));
   if (!cogl_framebuffer_allocate (priv->new_offscreen, &catch_error))
     {
-      cogl_error_free (catch_error);
+      g_error_free (catch_error);
       cogl_clear_object (&priv->new_offscreen);
       return FALSE;
     }


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