possibly avoid a race with the path
authorDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 16:46:42 +0000 (12:46 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 16:46:42 +0000 (12:46 -0400)
src/preview_update.c
src/theme.c

index 9628326..1b2d12b 100644 (file)
@@ -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();
 
index 48deb03..093dc21 100644 (file)
@@ -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;