--- testgtk.c	2004-04-26 00:42:32.000000000 +1000
+++ testgtk2.c	2004-04-26 00:42:44.000000000 +1000
@@ -1960,6 +1960,8 @@
   GtkWidget *entry;
   GtkWidget *label;
 
+  gpointer pwindow;
+
   if (!window)
     {
       window = gtk_dialog_new_with_buttons ("Gridded Geometry",
@@ -1980,7 +1982,8 @@
 
       g_signal_connect (window, "response",
 			G_CALLBACK (gridded_geometry_response), entry);
-      g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
+      g_object_add_weak_pointer (G_OBJECT (window), &pwindow);
+      window = (GtkWidget*) &pwindow;
 
       gtk_widget_show_all (window);
     }
@@ -4116,6 +4119,7 @@
 create_key_lookup (GtkWidget *widget)
 {
   static GtkWidget *window = NULL;
+  gpointer pwindow;
 
   if (!window)
     {
@@ -4156,7 +4160,8 @@
       button = gtk_button_new_with_mnemonic ("Button 11 (_!)");
       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), button, FALSE, FALSE, 0);
       
-      g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
+      g_object_add_weak_pointer (G_OBJECT (window), &pwindow);
+      window = (GtkWidget*) &pwindow;
       g_signal_connect (window, "response", G_CALLBACK (gtk_object_destroy), NULL);
 
       gtk_widget_show_all (window);
@@ -11246,28 +11251,33 @@
   GdkWindow *pointer_window;
   gint x, y;
   FindWidgetData data;
+
+  gpointer pwidget;
  
- pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
+  pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
  
- if (pointer_window)
-   gdk_window_get_user_data (pointer_window, (gpointer*) &widget);
+  if (pointer_window)
+  { 
+    gdk_window_get_user_data (pointer_window, &pwidget);
+    widget = (GtkWidget*) &pwidget;
+  }
 
- if (widget)
-   {
-     gdk_window_get_pointer (widget->window,
-			     &x, &y, NULL);
+  if (widget)
+  {
+    gdk_window_get_pointer (widget->window,
+ 			     &x, &y, NULL);
      
-     data.x = x;
-     data.y = y;
-     data.found = FALSE;
-     data.first = TRUE;
-
-     find_widget (widget, &data);
-     if (data.found)
-       return data.res_widget;
-     return widget;
-   }
- return NULL;
+    data.x = x;
+    data.y = y;
+    data.found = FALSE;
+    data.first = TRUE;
+
+    find_widget (widget, &data);
+    if (data.found)
+      return data.res_widget;
+    return widget;
+  }
+  return NULL;
 }
 
 struct PropertiesData {
