From: Mario Rugiero <mrugi...@gmail.com>

The case where a single package comes with both cursor and
icon themes is evaluated before the theme structure is actually
loaded.

Because of how the rest of the code handles it, there are five
possible scenarios caused because of this:
1_ The program crashes. This is most likely when theme ends up
   pointing to a protected address.
2_ A true positive. Everything works as intended.
3_ A false positive. Nothing bad happens, because it iterates
   and looks for the corresponding theme, failing gracefully
   if it doesn't exist.
4_ A true negative. Everything works as intended.
5_ A false negative. Since it won't look for the corresponding
   theme, we end up leaving trash behind us.

I didn't actually certify that all of this happens as described,
mostly because I couldn't find a theme containing both icons
and cursors.
I did try erasing a few themes to make sure I didn't break anything,
Plus, the change is rather trivial, so it's unlikely I made any
mistakes here.
---
 src/icon-theme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/icon-theme.c b/src/icon-theme.c
index 7fba616..5416351 100644
--- a/src/icon-theme.c
+++ b/src/icon-theme.c
@@ -171,7 +171,6 @@ static void on_remove_theme_clicked(GtkButton* btn, 
gpointer user_data)
     if(gtk_tree_selection_get_selected(sel, &model, &it))
     {
         IconTheme* theme;
-        gboolean both = theme->has_icon && theme->has_cursor;
 
         if(gtk_tree_model_iter_n_children(model, NULL) < 2)
         {
@@ -190,6 +189,7 @@ static void on_remove_theme_clicked(GtkButton* btn, 
gpointer user_data)
             gtk_tree_selection_select_iter(sel, &it);
 
             /* FIXME: in rare case, a theme can contain both icons and cursors 
*/
+            gboolean both = theme->has_icon && theme->has_cursor;
             if(both) /* we need to remove item in another list store, too */
             {
                 model = GTK_TREE_MODEL(model == 
(GtkTreeModel*)app.icon_theme_store ? app.cursor_theme_store : 
app.icon_theme_store);
-- 
2.17.1



_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to