[librsvg] rsvg-filter: Return NULL for invalid surfaces in rsvg_filter_get_{result, in}()



commit d4587391cf11915fc6129aeaaf5d013292fa0d4b
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jul 7 11:38:56 2017 -0500

    rsvg-filter: Return NULL for invalid surfaces in rsvg_filter_get_{result,in}()

 rsvg-filter.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index 394ded1..ff7172c 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -723,7 +723,6 @@ rsvg_filter_get_bg (RsvgFilterContext * ctx)
     return ctx->bg_surface;
 }
 
-/* FIXMEchpe: proper return value and out param! */
 /**
  * rsvg_filter_get_result:
  * @name: The name of the surface
@@ -769,24 +768,21 @@ rsvg_filter_get_result (GString * name, RsvgFilterContext * ctx)
         return output;
     }
 
-    /* g_warning (_("%s not found\n"), name->str); */
-
-    output = ctx->lastresult;
-    cairo_surface_reference (output.surface);
+    output.surface = NULL;
     return output;
 }
 
-/**
- * rsvg_filter_get_in:
- * @name:
- * @ctx:
- *
- * Returns: (transfer full) (nullable): a new #cairo_surface_t, or %NULL
- */
 static cairo_surface_t *
 rsvg_filter_get_in (GString * name, RsvgFilterContext * ctx)
 {
-    return rsvg_filter_get_result (name, ctx).surface;
+    cairo_surface_t *surface;
+
+    surface = rsvg_filter_get_result (name, ctx).surface;
+    if (surface == NULL || cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
+        return NULL;
+    }
+
+    return surface;
 }
 
 static void


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