diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 715bfea..201b8f1 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -706,11 +706,14 @@ gtk_accel_group_connect_by_path (GtkAccelGroup	*accel_group,
 /**
  * gtk_accel_group_disconnect:
  * @accel_group: the accelerator group to remove an accelerator from
- * @closure:     the closure to remove from this accelerator group
+ * @closure:     the closure to remove from this accelerator group, or %NULL
+ *               to remove all closures
  * @returns:     %TRUE if the closure was found and got disconnected
  *
  * Removes an accelerator previously installed through
  * gtk_accel_group_connect().
+ *
+ * Since 2.20 @closure can be %NULL.
  */
 gboolean
 gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
@@ -721,7 +724,7 @@ gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
   g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
 
   for (i = 0; i < accel_group->priv->n_accels; i++)
-    if (accel_group->priv->priv_accels[i].closure == closure)
+    if (accel_group->priv->priv_accels[i].closure == closure || !closure)
       {
 	g_object_ref (accel_group);
 	quick_accel_remove (accel_group, i);
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index edbdce3..8971c06 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -347,7 +347,6 @@ _gtk_socket_end_embedding (GtkSocket *socket)
 {
   GtkSocketPrivate *private = _gtk_socket_get_private (socket);
   GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
-  gint i;
   
   if (GTK_IS_WINDOW (toplevel))
     _gtk_socket_windowing_end_embedding_toplevel (socket);
@@ -358,12 +357,7 @@ _gtk_socket_end_embedding (GtkSocket *socket)
   socket->current_height = 0;
   private->resize_count = 0;
 
-  /* Remove from end to avoid indexes shifting. This is evil */
-  for (i = socket->accel_group->n_accels - 1; i >= 0; i--)
-    {
-      GtkAccelGroupEntry *accel_entry = &socket->accel_group->priv_accels[i];
-      gtk_accel_group_disconnect (socket->accel_group, accel_entry->closure);
-    }
+  gtk_accel_group_disconnect (socket->accel_group, NULL);
 }
 
 static void
@@ -569,22 +563,9 @@ _gtk_socket_remove_grabbed_key (GtkSocket      *socket,
 				guint           keyval,
 				GdkModifierType modifiers)
 {
-  gint i;
-
-  for (i = 0; i < socket->accel_group->n_accels; i++)
-    {
-      GtkAccelGroupEntry *accel_entry = &socket->accel_group->priv_accels[i];
-      if (accel_entry->key.accel_key == keyval &&
-	  accel_entry->key.accel_mods == modifiers)
-	{
-	  gtk_accel_group_disconnect (socket->accel_group,
-				      accel_entry->closure);
-	  return;
-	}
-    }
-
-  g_warning ("GtkSocket: request to remove non-present grabbed key %u,%#x\n",
-	     keyval, modifiers);
+  if (!gtk_accel_group_disconnect_key (socket->accel_group, keyval, modifiers))
+    g_warning ("GtkSocket: request to remove non-present grabbed key %u,%#x\n",
+	       keyval, modifiers);
 }
 
 static void
