[librsvg: 4/18] Log all errors in c_api to get diagnostics from apps which pass a NULL GError



commit 9b84dd77b42052cb3f0ef217144e364e52ae1a86
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Dec 5 22:18:41 2019 -0600

    Log all errors in c_api to get diagnostics from apps which pass a NULL GError

 librsvg/c_api.rs | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 8086f935..7acd53e6 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -1536,6 +1536,13 @@ pub(crate) fn set_gerror(err: *mut *mut glib_sys::GError, code: u32, msg: &str)
         // this is RSVG_ERROR_FAILED, the only error code available in RsvgError
         assert!(code == 0);
 
+        // Log this, in case the calling program passes a NULL GError, so we can at least
+        // diagnose things by asking for RSVG_LOG.
+        //
+        // See https://gitlab.gnome.org/GNOME/gtk/issues/2294 for an example of code that
+        // passed a NULL GError and so we had no easy way to see what was wrong.
+        rsvg_log!("{}", msg);
+
         glib_sys::g_set_error_literal(
             err,
             rsvg_rust_error_quark(),


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