]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix assertion on SVG load failure
authorAlan Third <alan@idiocy.org>
Sat, 12 Dec 2020 23:52:00 +0000 (23:52 +0000)
committerAlan Third <alan@idiocy.org>
Sat, 12 Dec 2020 23:53:47 +0000 (23:53 +0000)
* src/image.c (svg_load_image): Move setting DPI to after rsvg_handle
error checking.

src/image.c

index 6b85ab78f61289ec1edcec34bdd1001fb38db759..a3301ad2ddad94b78421fbb489ff34dcad8a9799 100644 (file)
@@ -9872,8 +9872,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
                                                  RSVG_HANDLE_FLAGS_NONE,
                                                  NULL, &err);
-  rsvg_handle_set_dpi_x_y (rsvg_handle, FRAME_DISPLAY_INFO (f)->resx,
-                           FRAME_DISPLAY_INFO (f)->resy);
 
   if (base_file)
     g_object_unref (base_file);
@@ -9881,6 +9879,9 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
 
   /* Check rsvg_handle too, to avoid librsvg 2.40.13 bug (Bug#36773#26).  */
   if (!rsvg_handle || err) goto rsvg_error;
+
+  rsvg_handle_set_dpi_x_y (rsvg_handle, FRAME_DISPLAY_INFO (f)->resx,
+                           FRAME_DISPLAY_INFO (f)->resy);
 #else
   /* Make a handle to a new rsvg object.  */
   rsvg_handle = rsvg_handle_new ();
@@ -10045,15 +10046,15 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
                                                  RSVG_HANDLE_FLAGS_NONE,
                                                  NULL, &err);
 
-  rsvg_handle_set_dpi_x_y (rsvg_handle, FRAME_DISPLAY_INFO (f)->resx,
-                           FRAME_DISPLAY_INFO (f)->resy);
-
   if (base_file)
     g_object_unref (base_file);
   g_object_unref (input_stream);
 
   /* Check rsvg_handle too, to avoid librsvg 2.40.13 bug (Bug#36773#26).  */
   if (!rsvg_handle || err) goto rsvg_error;
+
+  rsvg_handle_set_dpi_x_y (rsvg_handle, FRAME_DISPLAY_INFO (f)->resx,
+                           FRAME_DISPLAY_INFO (f)->resy);
 #else
   /* Make a handle to a new rsvg object.  */
   rsvg_handle = rsvg_handle_new ();