[gimp] plug-ins: use a domain on g_set_error().



commit 88e6dc46afb1f471cb09c498943693c55234a007
Author: Jehan <jehan girinstud io>
Date:   Tue Sep 26 23:48:52 2017 +0200

    plug-ins: use a domain on g_set_error().
    
    Without a domain error, glib outputs on console:
    > g_error_new_valist: runtime check failed: (domain != 0)
    Let's just create a domain error for the file-pdf-load plugin.

 plug-ins/common/file-pdf-load.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 5989ba0..5b03cb1 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -43,6 +43,12 @@
 
 #define THUMBNAIL_SIZE  128
 
+#define GIMP_PLUGIN_PDF_LOAD_ERROR gimp_plugin_pdf_load_error_quark ()
+static GQuark
+gimp_plugin_pdf_load_error_quark (void)
+{
+  return g_quark_from_static_string ("gimp-plugin-pdf-load-error-quark");
+}
 
 /* Structs for the load dialog */
 typedef struct
@@ -490,7 +496,7 @@ run (const gchar      *name,
                               if (param[5].data.d_int32array[i] >= doc_n_pages)
                                 {
                                   status = GIMP_PDB_EXECUTION_ERROR;
-                                  g_set_error (&error, 0, 0,
+                                  g_set_error (&error, GIMP_PLUGIN_PDF_LOAD_ERROR, 0,
                                                /* TRANSLATORS: first argument is file name,
                                                 * second is out-of-range page number, third is
                                                 * number of pages. Specify order as in English if needed.
@@ -669,7 +675,7 @@ open_document (const gchar  *filename,
 
   if (! mapped_file)
     {
-      g_set_error (load_error, 0, 0,
+      g_set_error (load_error, GIMP_PLUGIN_PDF_LOAD_ERROR, 0,
                    _("Could not load '%s': %s"),
                    gimp_filename_to_utf8 (filename), error->message);
       g_error_free (error);


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