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



commit 2f55461824855af06ffd31abf8f8acfd4a42656e
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 8f7c219..e688d75 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -676,7 +676,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
@@ -722,24 +721,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]