]> Pileus Git - ~andy/gtk/commitdiff
Fixed recursing bug in gdk_exit_func()
authorElliot Lee <sopwith@src.gnome.org>
Fri, 2 Jan 1998 03:43:24 +0000 (03:43 +0000)
committerElliot Lee <sopwith@src.gnome.org>
Fri, 2 Jan 1998 03:43:24 +0000 (03:43 +0000)
gdk/gdk.c
gdk/x11/gdkmain-x11.c

index d9413e9aeb8b746c2dd121d5d20ab1ee2f6755d7..782037324939ccc01eea1e9909ba08ab34107a01 100644 (file)
--- 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
index d9413e9aeb8b746c2dd121d5d20ab1ee2f6755d7..782037324939ccc01eea1e9909ba08ab34107a01 100644 (file)
@@ -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