#include <gtk/gtk.h>
#include <unistd.h>

GtkWidget *window1, *window2, *window3;

static gboolean
expose (GtkWidget      *widget,
	GdkEventExpose *event)
{
  gtk_widget_destroy (window1);
  gtk_widget_destroy (window3);

  gdk_flush ();
  sleep (3);
  while (g_main_iteration (FALSE));

  return FALSE;
}

int 
main (int argc, char **argv)
{
  gtk_init (&argc, &argv);

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  g_signal_connect_after (window2, "expose_event",
			  G_CALLBACK (expose), NULL);

  gtk_widget_show_all (window1);
  gtk_widget_show_all (window2);
  gtk_widget_show_all (window3);

  gdk_flush ();
  sleep (3);
  
  gtk_main ();
  
  return 0;
}
