Package: gtk+2.0
Severity: important
Tags: patch

gtk_recent_files_menu_populate() does not guard against recursion, which
can cause crashes when large sets of files are manipulated (think:
pbuilder). The attached patch corrects this behaviour.

It is also a bug filed in GNOME bugzilla at:
  http://bugzilla.gnome.org/show_bug.cgi?id=507605

and also in Ubuntu (via Launchpad) at:
  https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/180463

Please consider applying this patch as soon as possible.

William
diff -urN gtk+2.0-2.12.3/gtk/gtkrecentchoosermenu.c gtk+2.0-2.12.3+fix/gtk/gtkrecentchoosermenu.c
--- gtk+2.0-2.12.3/gtk/gtkrecentchoosermenu.c	2007-12-04 10:52:08.000000000 -0600
+++ gtk+2.0-2.12.3+fix/gtk/gtkrecentchoosermenu.c	2008-01-04 23:22:01.000000000 -0600
@@ -926,8 +926,6 @@
   pdata = (MenuPopulateData *) data;
   priv = pdata->menu->priv;
 
-  priv->populate_id = 0;
-
   if (!pdata->items)
     {
       pdata->items = gtk_recent_chooser_get_items (GTK_RECENT_CHOOSER (pdata->menu));
@@ -936,6 +934,7 @@
           /* show the placeholder here */
           gtk_widget_show (pdata->placeholder);
           pdata->displayed_items = 1;
+          priv->populate_id = 0;
 
 	  return FALSE;
 	}
@@ -978,6 +977,8 @@
       g_list_foreach (pdata->items, (GFunc) gtk_recent_info_unref, NULL);
       g_list_free (pdata->items);
 
+      priv->populate_id = 0;
+
       retval = FALSE;
     }
   else
@@ -991,14 +992,17 @@
 {
   MenuPopulateData *pdata = data;
 
-  /* show the placeholder in case no item survived
-   * the filtering process in the idle loop
-   */
-  if (!pdata->displayed_items)
-    gtk_widget_show (pdata->placeholder);
-  g_object_unref (pdata->placeholder);
+  if (pdata->menu->priv->populate_id == 0)
+    {
+      /* show the placeholder in case no item survived
+       * the filtering process in the idle loop
+       */
+      if (!pdata->displayed_items)
+        gtk_widget_show (pdata->placeholder);
+      g_object_unref (pdata->placeholder);
 
-  g_slice_free (MenuPopulateData, data);
+      g_slice_free (MenuPopulateData, data);
+    }
 }
 
 static void

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to