From d2a6d23b08f8052834a55966ed96187ce824f92d Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 4 Aug 2007 12:46:42 -0400 Subject: [PATCH] possibly avoid a race with the path --- src/preview_update.c | 8 +++++--- src/theme.c | 14 ++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/preview_update.c b/src/preview_update.c index 9628326..1b2d12b 100644 --- a/src/preview_update.c +++ b/src/preview_update.c @@ -104,9 +104,11 @@ static gboolean update_theme_preview_iterate(gpointer data) restart_theme_preview_update = TRUE; gtk_tree_view_get_cursor(tree_view, &path, NULL); - gtk_tree_view_scroll_to_cell(tree_view, path, NULL, - FALSE, 0, 0); - gtk_tree_path_free(path); + if (path) { + gtk_tree_view_scroll_to_cell(tree_view, path, NULL, + FALSE, 0, 0); + gtk_tree_path_free(path); + } obconf_show_main(); diff --git a/src/theme.c b/src/theme.c index 48deb03..093dc21 100644 --- a/src/theme.c +++ b/src/theme.c @@ -175,7 +175,6 @@ void theme_load_all() GList *it, *next; gint i; GtkWidget *w; - GtkTreePath *path = NULL; RrFont *active, *inactive, *menu_t, *menu_i, *osd; mapping = TRUE; @@ -228,20 +227,19 @@ void theme_load_all() 2, 1.0, /* all previews are right-aligned */ -1); - if(!strcmp(name, it->data)) + if(!strcmp(name, it->data)) { + GtkTreePath *path; + path = gtk_tree_path_new_from_indices(i, -1); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(w), path, NULL, FALSE); + gtk_tree_path_free(path); + } ++i; } preview_update_all(); - /* do this after starting the preview update */ - if (path) { - gtk_tree_view_set_cursor(GTK_TREE_VIEW(w), path, NULL, FALSE); - gtk_tree_path_free(path); - } - g_free(name); mapping = FALSE; -- 2.39.2