From: Daiki Ueno <ueno@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 21641@debbugs.gnu.org
Subject: bug#21641: 25.0.50; Emacs crash on network connection?
Date: Thu, 08 Oct 2015 14:46:08 +0900 [thread overview]
Message-ID: <m3lhbdzzdr.fsf-ueno@gnu.org> (raw)
In-Reply-To: <838u7eefkc.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 07 Oct 2015 20:47:31 +0300")
[-- Attachment #1: Type: text/plain, Size: 511 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-image.c-use-g_clear_error-instead-of-g_error_free.patch --]
[-- Type: text/x-patch, Size: 2216 bytes --]
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
next prev parent reply other threads:[~2015-10-08 5:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 13:28 bug#21641: 25.0.50; Emacs crash on network connection? Lars Magne Ingebrigtsen
2015-10-07 16:48 ` Glenn Morris
2015-10-07 17:14 ` Eli Zaretskii
2015-10-07 17:22 ` Glenn Morris
2015-10-07 17:30 ` Eli Zaretskii
2015-10-07 17:47 ` Eli Zaretskii
2015-10-07 17:55 ` Glenn Morris
2015-10-07 18:01 ` Eli Zaretskii
2015-10-08 5:46 ` Daiki Ueno [this message]
2015-10-08 15:07 ` Eli Zaretskii
2015-10-07 18:29 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3lhbdzzdr.fsf-ueno@gnu.org \
--to=ueno@gnu.org \
--cc=21641@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).