diff -uNr gtk+2.0-2.11.5/gtk/gtkentry.c gtk+2.0-2.11.5.new/gtk/gtkentry.c 
--- gtk+2.0-2.11.5/gtk/gtkentry.c	2007-07-02 23:04:01.000000000 +0800
+++ gtk+2.0-2.11.5.new/gtk/gtkentry.c	2007-07-20 17:04:49.088194355 +0800
@@ -3193,6 +3193,8 @@
 
   entry = GTK_ENTRY (data);
 
+  GDK_THREADS_ENTER ();
+
   entry->recompute_idle = 0;
   
   if (gtk_widget_has_screen (GTK_WIDGET (entry)))
@@ -3203,6 +3205,8 @@
       update_im_cursor_location (entry);
     }
 
+  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 
@@ -3241,9 +3245,13 @@
 static gboolean
 gtk_entry_remove_password_hint (gpointer data)
 {
+  GDK_THREADS_ENTER();
+
   /* Force the string to be redrawn, but now without a visible character */
   gtk_entry_recompute (GTK_ENTRY (data));
 
+  GDK_THREADS_LEAVE();
+
   return FALSE;
 }
 
@@ -5607,6 +5615,8 @@
   GtkEntryPrivate *priv; 
   gint blink_timeout;
 
+  GDK_THREADS_ENTER ();
+
   entry = GTK_ENTRY (data);
   priv = GTK_ENTRY_GET_PRIVATE (entry);
  
@@ -5647,6 +5657,8 @@
 					    entry);
     }
 
+  GDK_THREADS_LEAVE ();
+
   /* Remove ourselves */
   return FALSE;
 }
@@ -5713,6 +5725,8 @@
 {
   GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data);
 
+  GDK_THREADS_ENTER ();
+
   completion->priv->completion_timeout = 0;
 
   if (completion->priv->filter_model &&
@@ -5749,6 +5763,8 @@
   else if (GTK_WIDGET_VISIBLE (completion->priv->popup_window))
     _gtk_entry_completion_popdown (completion);
 
+  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 
diff -uNr gtk+2.0-2.11.5/gtk/gtkwidget.c gtk+2.0-2.11.5.new/gtk/gtkwidget.c
--- gtk+2.0-2.11.5/gtk/gtkwidget.c	2007-07-02 23:04:00.000000000 +0800
+++ gtk+2.0-2.11.5.new/gtk/gtkwidget.c	2007-07-23 12:08:16.345209825 +0800
@@ -6869,7 +6869,7 @@
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
   
-  while (widget->parent)
+  while (widget->parent && GTK_IS_WIDGET(widget->parent))
     widget = widget->parent;
   
   return widget;
