From af9e316ce68828fdc77110b06e77502126bec759 Mon Sep 17 00:00:00 2001 From: Elliot Lee Date: Fri, 2 Jan 1998 03:43:24 +0000 Subject: [PATCH] Fixed recursing bug in gdk_exit_func() --- gdk/gdk.c | 8 ++++++++ gdk/x11/gdkmain-x11.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/gdk/gdk.c b/gdk/gdk.c index d9413e9aeb..7820373249 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -2844,6 +2844,14 @@ gdk_synthesize_click (GdkEvent *event, static void gdk_exit_func () { + static gboolean in_gdk_exit_func = FALSE; + + /* This is to avoid an infinite loop if a program segfaults in + an atexit() handler (and yes, it does happen, especially if a program + has trounced over memory too badly for even g_print to work) */ + if(in_gdk_exit_func == TRUE) return; + in_gdk_exit_func = TRUE; + if (initialized) { #ifdef USE_XIM diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index d9413e9aeb..7820373249 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -2844,6 +2844,14 @@ gdk_synthesize_click (GdkEvent *event, static void gdk_exit_func () { + static gboolean in_gdk_exit_func = FALSE; + + /* This is to avoid an infinite loop if a program segfaults in + an atexit() handler (and yes, it does happen, especially if a program + has trounced over memory too badly for even g_print to work) */ + if(in_gdk_exit_func == TRUE) return; + in_gdk_exit_func = TRUE; + if (initialized) { #ifdef USE_XIM