Commit 93a1d3d2 authored by Chris Wilson's avatar Chris Wilson Committed by Chris Wilson

Remove a surplus GDK_THREADS_LEAVE() and avoid a potential use after free

2007-07-04  Chris Wilson  <chris@chris-wilson.co.uk>

    * gtk/gtkrecentchoosermenu.c (idle_populate_func),
    (idle_populate_clean_up), (gtk_recent_chooser_menu_populate):
    Remove a surplus GDK_THREADS_LEAVE() and avoid a potential use after
    free in the source destroy notify. (#453033)


svn path=/trunk/; revision=18375
parent 631806a2
2007-07-04 Chris Wilson <chris@chris-wilson.co.uk>
* gtk/gtkrecentchoosermenu.c (idle_populate_func),
(idle_populate_clean_up), (gtk_recent_chooser_menu_populate):
Remove a surplus GDK_THREADS_LEAVE() and avoid a potential use after
free in the source destroy notify. (#453033)
2007-07-04 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtkcelllayout.c (_gtk_cell_layout_buildable_add_child):
......
......@@ -921,6 +921,7 @@ typedef struct
gint loaded_items;
gint displayed_items;
GtkRecentChooserMenu *menu;
GtkWidget *placeholder;
} MenuPopulateData;
static gboolean
......@@ -943,11 +944,9 @@ idle_populate_func (gpointer data)
if (!pdata->items)
{
/* show the placeholder here */
gtk_widget_show (priv->placeholder);
gtk_widget_show (pdata->placeholder);
pdata->displayed_items = 1;
GDK_THREADS_LEAVE ();
return FALSE;
}
......@@ -1001,13 +1000,13 @@ static void
idle_populate_clean_up (gpointer data)
{
MenuPopulateData *pdata = data;
GtkRecentChooserMenuPrivate *priv = pdata->menu->priv;
/* show the placeholder in case no item survived
* the filtering process in the idle loop
*/
if (!pdata->displayed_items)
gtk_widget_show (priv->placeholder);
gtk_widget_show (pdata->placeholder);
g_object_unref (pdata->placeholder);
g_slice_free (MenuPopulateData, data);
}
......@@ -1027,6 +1026,7 @@ gtk_recent_chooser_menu_populate (GtkRecentChooserMenu *menu)
pdata->loaded_items = 0;
pdata->displayed_items = 0;
pdata->menu = menu;
pdata->placeholder = g_object_ref (priv->placeholder);
priv->icon_size = get_icon_size_for_widget (GTK_WIDGET (menu));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment