bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#21641: 25.0.50; Emacs crash on network connection?


From: Daiki Ueno
Subject: bug#21641: 25.0.50; Emacs crash on network connection?
Date: Thu, 08 Oct 2015 14:46:08 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> Btw, after making this change, I see a lot of error messages from Glib
> (called by librsvg), like this:
>
>   (emacs.exe:1624): GLib-CRITICAL **: g_error_free: assertion 'error
> != NULL' failed

How about using g_clear_error to avoid this kind of g_error_free usage?
The function has been there since glib 2.0, so there shouldn't be a
compatibility issue.

gtkutil.c has similar code reusing GError variable, which could be
simplified as well.

Regards,
-- 
Daiki Ueno
>From b2be270bb367d925fce9b53be84771aaeb9691c7 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@gnu.org>
Date: Thu, 8 Oct 2015 12:43:37 +0900
Subject: [PATCH] image.c: use g_clear_error, instead of g_error_free

* src/image.c: Define g_clear_error, instead of g_error_free.
(init_svg_functions): Resolve DLL function g_clear_error, instead
of g_error_free.
(svg_load_image): Use g_clear_error, instead of g_error_free.
---
 src/image.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/image.c b/src/image.c
index 10b067f..418c656 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9004,7 +9004,7 @@ DEF_DLL_FN (int, gdk_pixbuf_get_bits_per_sample, (const 
GdkPixbuf *));
 DEF_DLL_FN (void, g_type_init, (void));
 #  endif
 DEF_DLL_FN (void, g_object_unref, (gpointer));
-DEF_DLL_FN (void, g_error_free, (GError *));
+DEF_DLL_FN (void, g_clear_error, (GError **));
 
 static bool
 init_svg_functions (void)
@@ -9042,7 +9042,7 @@ init_svg_functions (void)
   LOAD_DLL_FN (gobject, g_type_init);
 #  endif
   LOAD_DLL_FN (gobject, g_object_unref);
-  LOAD_DLL_FN (glib, g_error_free);
+  LOAD_DLL_FN (glib, g_clear_error);
 
   return 1;
 }
@@ -9058,7 +9058,7 @@ init_svg_functions (void)
 #  undef gdk_pixbuf_get_pixels
 #  undef gdk_pixbuf_get_rowstride
 #  undef gdk_pixbuf_get_width
-#  undef g_error_free
+#  undef g_clear_error
 #  undef g_object_unref
 #  undef g_type_init
 #  undef rsvg_handle_close
@@ -9076,7 +9076,7 @@ init_svg_functions (void)
 #  define gdk_pixbuf_get_pixels fn_gdk_pixbuf_get_pixels
 #  define gdk_pixbuf_get_rowstride fn_gdk_pixbuf_get_rowstride
 #  define gdk_pixbuf_get_width fn_gdk_pixbuf_get_width
-#  define g_error_free fn_g_error_free
+#  define g_clear_error fn_g_clear_error
 #  define g_object_unref fn_g_object_unref
 #  define g_type_init fn_g_type_init
 #  define rsvg_handle_close fn_rsvg_handle_close
@@ -9331,7 +9331,7 @@ svg_load_image (struct frame *f,         /* Pointer to 
emacs frame structure.  *
   /* FIXME: Use error->message so the user knows what is the actual
      problem with the image.  */
   image_error ("Error parsing SVG image `%s'", img->spec);
-  g_error_free (err);
+  g_clear_error (&err);
   return 0;
 }
 
-- 
2.4.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]