unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35548: image.c uses deprecated rsvg_handle_write etc.
@ 2019-05-03 19:23 Paul Eggert
  2019-07-04  3:14 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Eggert @ 2019-05-03 19:23 UTC (permalink / raw)
  To: 35548

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

I just upgraded my Emacs build platform to Fedora 30 and found that
Emacs wouldn't build when configured with --enable-gcc-warnings. The
problem is that starting in librsvg 2.45.1, the librsvg functions
rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
those functions. Although I pacified GCC by installing the attached
patch into Emacs master, the underlying problem is still there and an
rsvg expert should take a look at this at some point.


[-- Attachment #2: 0001-Pacify-librsvg-2.45.1-and-later.patch --]
[-- Type: text/x-patch, Size: 2514 bytes --]

From da3897abf1e45741b122b52df37a5cbc68b2ad5d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 3 May 2019 12:16:33 -0700
Subject: [PATCH] Pacify librsvg 2.45.1 and later

* src/image.c (svg_load_image): Pacify librsvg 2.45.1 and later,
and add a FIXME comment about the deprecated librsvg functions.
---
 src/image.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/image.c b/src/image.c
index bf594987eb..3d724a773b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6735,7 +6735,7 @@ my_error_exit (j_common_ptr cinfo)
 
 
 /* Init source method for JPEG data source manager.  Called by
-   jpeg_read_header() before any data is actually read.  See
+   jpeg_read_header before any data is actually read.  See
    libjpeg.doc from the JPEG lib distribution.  */
 
 static void
@@ -6745,7 +6745,7 @@ our_common_init_source (j_decompress_ptr cinfo)
 
 
 /* Method to terminate data source.  Called by
-   jpeg_finish_decompress() after all data has been processed.  */
+   jpeg_finish_decompress after all data has been processed.  */
 
 static void
 our_common_term_source (j_decompress_ptr cinfo)
@@ -9456,7 +9456,18 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
      See rsvg bug 596114 - "image refs are relative to curdir, not .svg file"
      <https://gitlab.gnome.org/GNOME/librsvg/issues/33>. */
   if (filename)
-    rsvg_handle_set_base_uri(rsvg_handle, filename);
+    rsvg_handle_set_base_uri (rsvg_handle, filename);
+
+  /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
+     rsvg_handle_write and rsvg_handle_close.  FIXME: Use functions
+     like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
+     and remove this hack.  */
+  #if GNUC_PREREQ (4, 6, 0)
+   #pragma GCC diagnostic push
+  #endif
+  #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
+   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+  #endif
 
   /* Parse the contents argument and fill in the rsvg_handle.  */
   rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
@@ -9467,6 +9478,10 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   rsvg_handle_close (rsvg_handle, &err);
   if (err) goto rsvg_error;
 
+  #if GNUC_PREREQ (4, 6, 0)
+   #pragma GCC diagnostic pop
+  #endif
+
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))
     {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-05-03 19:23 bug#35548: image.c uses deprecated rsvg_handle_write etc Paul Eggert
@ 2019-07-04  3:14 ` YAMAMOTO Mitsuharu
  2019-07-04  4:19   ` YAMAMOTO Mitsuharu
  2019-07-04 12:53   ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: YAMAMOTO Mitsuharu @ 2019-07-04  3:14 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 35548

On Sat, 04 May 2019 04:23:32 +0900,
Paul Eggert wrote:
> 
> I just upgraded my Emacs build platform to Fedora 30 and found that
> Emacs wouldn't build when configured with --enable-gcc-warnings. The
> problem is that starting in librsvg 2.45.1, the librsvg functions
> rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
> those functions. Although I pacified GCC by installing the attached
> patch into Emacs master, the underlying problem is still there and an
> rsvg expert should take a look at this at some point.

If we omit Windows DLL stuff, then the patch would be as simple as
below.  But Eli may dislike this (even with DLL support) for the very
reasons he dislikes the patch for Bug#36315 the other participants
prefer:

  1. If Windows DLL support is completed, then it will add to a new
     entry to dynamic-library-alist for libgio that librsvg is using
     as a sub-library.
     (See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36315#62)

  2. It just looks like we are using libgio and not librsvg.
     (See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36315#56)

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

diff --git a/src/image.c b/src/image.c
index 6ead12166b6..6d065d66f0f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9490,6 +9490,21 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   g_type_init ();
 #endif
 
+#if LIBRSVG_CHECK_VERSION (2, 32, 0) && !defined WINDOWSNT
+  /* In order to replace rsvg_handle_write and rsvg_handle_close that
+     are deprecated in librsvg 2.45.1 (Bug#35548), we need
+     rsvg_handle_new_from_stream_sync that requires librsvg
+     2.32.0.  */
+  GInputStream *input_stream = g_memory_input_stream_new_from_data (contents,
+								    size, NULL);
+  GFile *base_file = g_file_new_for_path (filename);
+  rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
+						  RSVG_HANDLE_FLAGS_NONE,
+						  NULL, &err);
+  g_object_unref (base_file);
+  g_object_unref (input_stream);
+  if (err) goto rsvg_error;
+#else
   /* Make a handle to a new rsvg object.  */
   rsvg_handle = rsvg_handle_new ();
 
@@ -9499,17 +9514,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   if (filename)
     rsvg_handle_set_base_uri (rsvg_handle, filename);
 
-  /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
-     rsvg_handle_write and rsvg_handle_close.  FIXME: Use functions
-     like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
-     and remove this hack.  */
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic push
-  #endif
-  #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
-   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-  #endif
-
   /* Parse the contents argument and fill in the rsvg_handle.  */
   rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
   if (err) goto rsvg_error;
@@ -9518,10 +9522,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
      for further writes.  */
   rsvg_handle_close (rsvg_handle, &err);
   if (err) goto rsvg_error;
-
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic pop
-  #endif
+#endif
 
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))






^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-04  3:14 ` YAMAMOTO Mitsuharu
@ 2019-07-04  4:19   ` YAMAMOTO Mitsuharu
  2019-07-10 19:44     ` Paul Eggert
  2019-07-04 12:53   ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: YAMAMOTO Mitsuharu @ 2019-07-04  4:19 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 35548

On Thu, 04 Jul 2019 12:14:08 +0900,
YAMAMOTO Mitsuharu wrote:
> 
> On Sat, 04 May 2019 04:23:32 +0900,
> Paul Eggert wrote:
> > 
> > I just upgraded my Emacs build platform to Fedora 30 and found that
> > Emacs wouldn't build when configured with --enable-gcc-warnings. The
> > problem is that starting in librsvg 2.45.1, the librsvg functions
> > rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
> > those functions. Although I pacified GCC by installing the attached
> > patch into Emacs master, the underlying problem is still there and an
> > rsvg expert should take a look at this at some point.
> 
> If we omit Windows DLL stuff, then the patch would be as simple as
> below.

Oops, I forgot NULL-check for filename.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

diff --git a/src/image.c b/src/image.c
index 6ead12166b6..726edb014dc 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9490,6 +9490,22 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   g_type_init ();
 #endif
 
+#if LIBRSVG_CHECK_VERSION (2, 32, 0) && !defined WINDOWSNT
+  /* In order to replace rsvg_handle_write and rsvg_handle_close that
+     are deprecated in librsvg 2.45.1 (Bug#35548), we need
+     rsvg_handle_new_from_stream_sync that requires librsvg
+     2.32.0.  */
+  GInputStream *input_stream = g_memory_input_stream_new_from_data (contents,
+								    size, NULL);
+  GFile *base_file = filename ? g_file_new_for_path (filename) : NULL;
+  rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
+						  RSVG_HANDLE_FLAGS_NONE,
+						  NULL, &err);
+  if (base_file)
+    g_object_unref (base_file);
+  g_object_unref (input_stream);
+  if (err) goto rsvg_error;
+#else
   /* Make a handle to a new rsvg object.  */
   rsvg_handle = rsvg_handle_new ();
 
@@ -9499,17 +9515,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   if (filename)
     rsvg_handle_set_base_uri (rsvg_handle, filename);
 
-  /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
-     rsvg_handle_write and rsvg_handle_close.  FIXME: Use functions
-     like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
-     and remove this hack.  */
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic push
-  #endif
-  #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
-   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-  #endif
-
   /* Parse the contents argument and fill in the rsvg_handle.  */
   rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
   if (err) goto rsvg_error;
@@ -9518,10 +9523,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
      for further writes.  */
   rsvg_handle_close (rsvg_handle, &err);
   if (err) goto rsvg_error;
-
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic pop
-  #endif
+#endif
 
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-04  3:14 ` YAMAMOTO Mitsuharu
  2019-07-04  4:19   ` YAMAMOTO Mitsuharu
@ 2019-07-04 12:53   ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-07-04 12:53 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 35548, eggert

> Date: Thu, 04 Jul 2019 12:14:08 +0900
> From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
> Cc: 35548@debbugs.gnu.org
> 
> If we omit Windows DLL stuff, then the patch would be as simple as
> below.  But Eli may dislike this (even with DLL support) for the very
> reasons he dislikes the patch for Bug#36315 the other participants
> prefer:

When we must move to other APIs because the libraries stop supporting
the ones we use, my liking or disliking that is hardly relevant.  It
would be unreasonable for me to put my preferences before development
needs, would it not?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-04  4:19   ` YAMAMOTO Mitsuharu
@ 2019-07-10 19:44     ` Paul Eggert
  2019-07-11 12:18       ` Andy Moreton
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Eggert @ 2019-07-10 19:44 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 35548-done

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

Thanks, I attempted to port that patch to MS-Windows, installed the attached, 
and am marking this bug as done.

[-- Attachment #2: 0001-Avoid-functions-deprecated-in-librsvg-2.45.1.patch --]
[-- Type: text/x-patch, Size: 6494 bytes --]

From 40cd6278ba965f3a9fcdddc568eb9ee7c69cf899 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 10 Jul 2019 12:37:55 -0700
Subject: [PATCH] Avoid functions deprecated in librsvg 2.45.1

* src/image.c (init_svg_functions) [WINDOWSNT]:
Load the pre-2.32 or 2.32 functions,
depending on LIBRSVG_CHECK_VERSION.
(svg_load_image): In librsvg 2.32 or later, use
g_memory_input_stream_new_from_data, g_file_new_for_path and
rsvg_handle_new_from_stream_sync rather than the
deprecated-in-2.45 rsvg_handle_write and rsvg_handle_close.
From a patch by YAMAMOTO Mitsuharu (Bug#35548#11).
---
 src/image.c | 82 +++++++++++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 28 deletions(-)

diff --git a/src/image.c b/src/image.c
index e898a7364a..3695342232 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9300,14 +9300,23 @@ svg_image_p (Lisp_Object object)
 # endif
 
 /* SVG library functions.  */
+#  if LIBRSVG_CHECK_VERSION (2, 32, 0)
+DEF_DLL_FN (GFile *, g_file_new_for_path, (char const *));
+DEF_DLL_FN (GInputStream *, g_memory_input_stream_new_from_data,
+	    (void const *, gssize, GDestroyNotify));
+DEF_DLL_FN (RsvgHandle *, rsvg_handle_new_from_stream_sync,
+	    (GInputStream *, GFile *, RsvgHandleFlags, GCancellable *,
+	     GError **error));
+#  else
 DEF_DLL_FN (RsvgHandle *, rsvg_handle_new, (void));
-DEF_DLL_FN (void, rsvg_handle_get_dimensions,
-	    (RsvgHandle *, RsvgDimensionData *));
+DEF_DLL_FN (void, rsvg_handle_set_base_uri, (RsvgHandle *, const char *));
 DEF_DLL_FN (gboolean, rsvg_handle_write,
 	    (RsvgHandle *, const guchar *, gsize, GError **));
 DEF_DLL_FN (gboolean, rsvg_handle_close, (RsvgHandle *, GError **));
+#endif
+DEF_DLL_FN (void, rsvg_handle_get_dimensions,
+	    (RsvgHandle *, RsvgDimensionData *));
 DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *));
-DEF_DLL_FN (void, rsvg_handle_set_base_uri, (RsvgHandle *, const char *));
 
 DEF_DLL_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *));
 DEF_DLL_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *));
@@ -9340,12 +9349,18 @@ init_svg_functions (void)
       return 0;
     }
 
+#if LIBRSVG_CHECK_VERSION (2, 32, 0)
+  LOAD_DLL_FN (glib, g_file_new_for_path);
+  LOAD_DLL_FN (glib, g_memory_input_stream_new_from_data);
+  LOAD_DLL_FN (library, rsvg_handle_new_from_stream_sync);
+#else
   LOAD_DLL_FN (library, rsvg_handle_new);
-  LOAD_DLL_FN (library, rsvg_handle_get_dimensions);
+  LOAD_DLL_FN (library, rsvg_handle_set_base_uri);
   LOAD_DLL_FN (library, rsvg_handle_write);
   LOAD_DLL_FN (library, rsvg_handle_close);
+#endif
+  LOAD_DLL_FN (library, rsvg_handle_get_dimensions);
   LOAD_DLL_FN (library, rsvg_handle_get_pixbuf);
-  LOAD_DLL_FN (library, rsvg_handle_set_base_uri);
 
   LOAD_DLL_FN (gdklib, gdk_pixbuf_get_width);
   LOAD_DLL_FN (gdklib, gdk_pixbuf_get_height);
@@ -9379,12 +9394,18 @@ init_svg_functions (void)
 #  undef g_clear_error
 #  undef g_object_unref
 #  undef g_type_init
-#  undef rsvg_handle_close
 #  undef rsvg_handle_get_dimensions
 #  undef rsvg_handle_get_pixbuf
-#  undef rsvg_handle_new
-#  undef rsvg_handle_set_base_uri
-#  undef rsvg_handle_write
+#  if LIBRSVG_CHECK_VERSION (2, 32, 0)
+#   undef g_file_new_for_path
+#   undef g_memory_input_stream_new_from_data
+#   undef rsvg_handle_new_from_stream_sync
+#  else
+#   undef rsvg_handle_close
+#   undef rsvg_handle_new
+#   undef rsvg_handle_set_base_uri
+#   undef rsvg_handle_write
+#  endif
 
 #  define gdk_pixbuf_get_bits_per_sample fn_gdk_pixbuf_get_bits_per_sample
 #  define gdk_pixbuf_get_colorspace fn_gdk_pixbuf_get_colorspace
@@ -9399,12 +9420,19 @@ init_svg_functions (void)
 #  if ! GLIB_CHECK_VERSION (2, 36, 0)
 #   define g_type_init fn_g_type_init
 #  endif
-#  define rsvg_handle_close fn_rsvg_handle_close
 #  define rsvg_handle_get_dimensions fn_rsvg_handle_get_dimensions
 #  define rsvg_handle_get_pixbuf fn_rsvg_handle_get_pixbuf
-#  define rsvg_handle_new fn_rsvg_handle_new
-#  define rsvg_handle_set_base_uri fn_rsvg_handle_set_base_uri
-#  define rsvg_handle_write fn_rsvg_handle_write
+#  if LIBRSVG_CHECK_VERSION (2, 32, 0)
+#   define g_file_new_for_path fn_g_file_new_for_path
+#   define g_memory_input_stream_new_from_data \
+	fn_g_memory_input_stream_new_from_data
+#   define rsvg_handle_new_from_stream_sync fn_rsvg_handle_new_from_stream_sync
+#  else
+#   define rsvg_handle_close fn_rsvg_handle_close
+#   define rsvg_handle_new fn_rsvg_handle_new
+#   define rsvg_handle_set_base_uri fn_rsvg_handle_set_base_uri
+#   define rsvg_handle_write fn_rsvg_handle_write
+#  endif
 
 # endif /* !WINDOWSNT  */
 
@@ -9489,6 +9517,18 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   g_type_init ();
 #endif
 
+#if LIBRSVG_CHECK_VERSION (2, 32, 0)
+  GInputStream *input_stream
+    = g_memory_input_stream_new_from_data (contents, size, NULL);
+  GFile *base_file = filename ? g_file_new_for_path (filename) : NULL;
+  rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
+						  RSVG_HANDLE_FLAGS_NONE,
+						  NULL, &err);
+  if (base_file)
+    g_object_unref (base_file);
+  g_object_unref (input_stream);
+  if (err) goto rsvg_error;
+#else
   /* Make a handle to a new rsvg object.  */
   rsvg_handle = rsvg_handle_new ();
 
@@ -9498,17 +9538,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   if (filename)
     rsvg_handle_set_base_uri (rsvg_handle, filename);
 
-  /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
-     rsvg_handle_write and rsvg_handle_close.  FIXME: Use functions
-     like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
-     and remove this hack.  */
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic push
-  #endif
-  #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
-   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-  #endif
-
   /* Parse the contents argument and fill in the rsvg_handle.  */
   rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
   if (err) goto rsvg_error;
@@ -9517,10 +9546,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
      for further writes.  */
   rsvg_handle_close (rsvg_handle, &err);
   if (err) goto rsvg_error;
-
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic pop
-  #endif
+#endif
 
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-10 19:44     ` Paul Eggert
@ 2019-07-11 12:18       ` Andy Moreton
  2019-07-11 12:52         ` Andy Moreton
  2019-07-11 13:30         ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Andy Moreton @ 2019-07-11 12:18 UTC (permalink / raw)
  To: 35548

On Wed 10 Jul 2019, Paul Eggert wrote:

> Thanks, I attempted to port that patch to MS-Windows, installed the attached,
> and am marking this bug as done.

This patch breaks SVG support on 64bit MSYS2 Windows builds, using
librsvg 2.44.14.

    AndyM






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-11 12:18       ` Andy Moreton
@ 2019-07-11 12:52         ` Andy Moreton
  2019-07-11 13:30         ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Andy Moreton @ 2019-07-11 12:52 UTC (permalink / raw)
  To: 35548

On Thu 11 Jul 2019, Andy Moreton wrote:

> On Wed 10 Jul 2019, Paul Eggert wrote:
>
>> Thanks, I attempted to port that patch to MS-Windows, installed the attached,
>> and am marking this bug as done.
>
> This patch breaks SVG support on 64bit MSYS2 Windows builds, using
> librsvg 2.44.14.

The problem is that some of the dynamically loaded functionas are
actually in gio, not glib. Please install the following patch to fix it.

diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 044b82ed1e..2e45d8623b 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -278,6 +278,7 @@ libgnutls-version
 	 '(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll")))
        '(svg "librsvg-2-2.dll")
        '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
+       '(gio "libgio-2.0-0.dll")
        '(glib "libglib-2.0-0.dll")
        '(gobject "libgobject-2.0-0.dll")
        (if (>= libgnutls-version 30400)
diff --git a/src/image.c b/src/image.c
index 3695342232..8ffb08b147 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9336,22 +9336,23 @@ DEF_DLL_FN (void, g_clear_error, (GError **));
 static bool
 init_svg_functions (void)
 {
-  HMODULE library, gdklib = NULL, glib = NULL, gobject = NULL;
+  HMODULE library, gdklib = NULL, gio = NULL, glib = NULL, gobject = NULL;
 
-  if (!(glib = w32_delayed_load (Qglib))
+  if (!(gio = w32_delayed_load (Qgio))
+      || !(glib = w32_delayed_load (Qglib))
       || !(gobject = w32_delayed_load (Qgobject))
       || !(gdklib = w32_delayed_load (Qgdk_pixbuf))
       || !(library = w32_delayed_load (Qsvg)))
     {
       if (gdklib)  FreeLibrary (gdklib);
       if (gobject) FreeLibrary (gobject);
       if (glib)    FreeLibrary (glib);
+      if (gio)     FreeLibrary (gio);
       return 0;
     }
 
 #if LIBRSVG_CHECK_VERSION (2, 32, 0)
-  LOAD_DLL_FN (glib, g_file_new_for_path);
-  LOAD_DLL_FN (glib, g_memory_input_stream_new_from_data);
+  LOAD_DLL_FN (gio, g_file_new_for_path);
+  LOAD_DLL_FN (gio, g_memory_input_stream_new_from_data);
   LOAD_DLL_FN (library, rsvg_handle_new_from_stream_sync);
 #else
   LOAD_DLL_FN (library, rsvg_handle_new);
@@ -10228,6 +10229,7 @@ syms_of_image (void)
 #ifdef HAVE_NTGUI
   /* Other libraries used directly by svg code.  */
   DEFSYM (Qgdk_pixbuf, "gdk-pixbuf");
+  DEFSYM (Qgio, "gio");
   DEFSYM (Qglib, "glib");
   DEFSYM (Qgobject, "gobject");
 #endif /* HAVE_NTGUI  */






^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-11 12:18       ` Andy Moreton
  2019-07-11 12:52         ` Andy Moreton
@ 2019-07-11 13:30         ` Eli Zaretskii
  2019-07-11 14:28           ` Andy Moreton
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-07-11 13:30 UTC (permalink / raw)
  To: Andy Moreton; +Cc: 35548

> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Thu, 11 Jul 2019 13:18:45 +0100
> 
> On Wed 10 Jul 2019, Paul Eggert wrote:
> 
> > Thanks, I attempted to port that patch to MS-Windows, installed the attached,
> > and am marking this bug as done.
> 
> This patch breaks SVG support on 64bit MSYS2 Windows builds, using
> librsvg 2.44.14.

Should be fixed now, thanks.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#35548: image.c uses deprecated rsvg_handle_write etc.
  2019-07-11 13:30         ` Eli Zaretskii
@ 2019-07-11 14:28           ` Andy Moreton
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Moreton @ 2019-07-11 14:28 UTC (permalink / raw)
  To: 35548

On Thu 11 Jul 2019, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Thu, 11 Jul 2019 13:18:45 +0100
>> 
>> On Wed 10 Jul 2019, Paul Eggert wrote:
>> 
>> > Thanks, I attempted to port that patch to MS-Windows, installed the attached,
>> > and am marking this bug as done.
>> 
>> This patch breaks SVG support on 64bit MSYS2 Windows builds, using
>> librsvg 2.44.14.
>
> Should be fixed now, thanks.

Thanks Eli, all working again.

    AndyM






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-07-11 14:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 19:23 bug#35548: image.c uses deprecated rsvg_handle_write etc Paul Eggert
2019-07-04  3:14 ` YAMAMOTO Mitsuharu
2019-07-04  4:19   ` YAMAMOTO Mitsuharu
2019-07-10 19:44     ` Paul Eggert
2019-07-11 12:18       ` Andy Moreton
2019-07-11 12:52         ` Andy Moreton
2019-07-11 13:30         ` Eli Zaretskii
2019-07-11 14:28           ` Andy Moreton
2019-07-04 12:53   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).