[librsvg] pattern: manually check cairo surface creation



commit 42e517ee2f279345e69af6c6386ac00848fcf0e6
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Jan 6 09:18:46 2020 +0100

    pattern: manually check cairo surface creation
    
    This will be removed when we update cairo-rs since the new
    version returns a Result for create_similar(), but until then
    let's check manually.

 rsvg_internals/src/pattern.rs | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index cd6fc83a..49420866 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -350,6 +350,12 @@ impl AsPaintSource for ResolvedPattern {
             .get_target()
             .create_similar(cairo::Content::ColorAlpha, pw, ph);
 
+        // FIXME: remove this once we update cairo-rs
+        let status = surface.status();
+        if status != cairo::Status::Success {
+            return Err(RenderingError::Cairo(status));
+        }
+
         let cr_pattern = cairo::Context::new(&surface);
 
         draw_ctx.set_cairo_context(&cr_pattern);


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