Index: modules/input/gtkimcontextxim.c
===================================================================
RCS file: /cvs/gnome/gtk+/modules/input/gtkimcontextxim.c,v
retrieving revision 1.32.2.5
diff -u -p -r1.32.2.5 gtkimcontextxim.c
--- modules/input/gtkimcontextxim.c	10 Jun 2003 18:25:25 -0000	1.32.2.5
+++ modules/input/gtkimcontextxim.c	13 Jun 2003 23:29:28 -0000
@@ -1320,7 +1320,7 @@ status_window_get (GtkIMContextXIM *cont
   screen = gdk_drawable_get_screen (toplevel_gdk);
   root_window = gdk_screen_get_root_window (screen);
   
-  while (TRUE)
+  while (TRUE && toplevel_gdk)
     {
       GdkWindow *parent = gdk_window_get_parent (toplevel_gdk);
       if (parent == root_window)
@@ -1428,6 +1428,6 @@ status_window_set_text (GtkIMContextXIM 
 void
 gtk_im_context_xim_shutdown (void)
 {
-  while (status_windows)
+  if (status_windows)
     status_window_free (status_windows->data);
 }
