[easytag] Fix possible overflow of reads in the file list



commit 4503eff78c7798fae7dd1f4abe67cda5297f279f
Author: David King <amigadave amigadave com>
Date:   Sat Mar 5 22:38:24 2016 +0000

    Fix possible overflow of reads in the file list
    
    When checking whether to read the file list on startup, use a gboolean rather
    than an int.

 src/browser.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 37c7d38..4d51eae 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -823,7 +823,7 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
     gchar *pathName;
     GFile *file;
     gchar *parse_name;
-    static int counter = 0;
+    static gboolean first_read = TRUE;
     GtkTreeIter selectedIter;
     GtkTreePath *selectedPath;
 
@@ -915,9 +915,10 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
     g_free (parse_name);
 
     /* Start to read the directory */
-    /* The first time, 'counter' is equal to zero. And if we don't want to load
-     * directory on startup, we skip the 'reading', but newt we must read it each time */
-    if (g_settings_get_boolean (MainSettings, "load-on-startup") || counter)
+    /* Skip loading the file list the first time that it is shown, if the user
+     * has requested the read to be skipped. */
+    if (!first_read
+        || g_settings_get_boolean (MainSettings, "load-on-startup"))
     {
         gboolean dir_loaded;
         GtkTreeIter parentIter;
@@ -960,7 +961,8 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
         /* As we don't use the function 'Read_Directory' we must add this function here */
         et_application_window_update_actions (ET_APPLICATION_WINDOW (MainWindow));
     }
-    counter++;
+
+    first_read = FALSE;
 
     g_object_unref (file);
     g_free(pathName);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]