[goffice] Disable metafiles support when there is no screen. [#748493]



commit 062e7185909cd88af0d0e2f4c83007c96b9b49f9
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Apr 28 13:52:29 2015 +0200

    Disable metafiles support when there is no screen. [#748493]

 ChangeLog                |    5 +++++
 NEWS                     |    3 +++
 goffice/utils/go-image.c |    6 +++++-
 3 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 72de922..bf4f9df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-28  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/utils/go-image.c (go_image_type_for_format): disable metafiles
+       support when there is no screen. [#748493]
+
 2015-04-16  Morten Welinder <terra gnome org>
 
        * configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index 7ae143e..33d96c0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.10.23:
 
+Jean:
+       * Disable metafiles support when there is no screen. [#748493]
+
 --------------------------------------------------------------------------
 goffice 0.10.22:
 
diff --git a/goffice/utils/go-image.c b/goffice/utils/go-image.c
index ead687d..b6a3830 100644
--- a/goffice/utils/go-image.c
+++ b/goffice/utils/go-image.c
@@ -710,8 +710,12 @@ go_image_type_for_format (char const *format)
        g_return_val_if_fail (format && *format, 0);
        if (!strcmp (format, "svg"))
                return GO_TYPE_SVG;
-       if (!strcmp (format, "emf") || !strcmp (format, "wmf"))
+       if (!strcmp (format, "emf") || !strcmp (format, "wmf")) {
+#warning Remove this when we have a widgetless canvas, see bug #748493
+               if (gdk_screen_get_default() == NULL)
+                       return 0;
                return GO_TYPE_EMF;
+       }
         if (!strcmp (format, "eps"))
                return GO_TYPE_SPECTRE;
        if (go_image_get_format_from_name (format) != GO_IMAGE_FORMAT_UNKNOWN)


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