Branch: refs/heads/master Author: LarsDW223 lars_paulsen@web.de Committer: LarsDW223 lars_paulsen@web.de Date: Mon, 02 Oct 2017 17:03:59 UTC Commit: daa71c69ffd689e08f6b31cc0b67d4bf3adf4b9e https://github.com/geany/geany-plugins/commit/daa71c69ffd689e08f6b31cc0b67d4...
Log Message: ----------- Workbench: fixed not closed file handles on directory scanning (thanks to techee). Fixes #607.
Modified Paths: -------------- workbench/src/plugin_main.c workbench/src/wb_project.c
Modified: workbench/src/plugin_main.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -128,7 +128,7 @@ void geany_load_module(GeanyPlugin *plugin) /* Set metadata */ plugin->info->name = _("Workbench"); plugin->info->description = _("Manage and customize multiple projects."); - plugin->info->version = "1.0"; + plugin->info->version = "1.01"; plugin->info->author = "LarsGit223";
/* Set functions */
Modified: workbench/src/wb_project.c 16 lines changed, 11 insertions(+), 5 deletions(-) =================================================================== @@ -228,6 +228,9 @@ static GSList *wb_project_dir_get_file_list(WB_PROJECT_DIR *root, const gchar *u { GSList *list = NULL; GDir *dir; + const gchar *child_name; + GSList *child; + GSList *children = NULL; gchar *locale_path = utils_get_locale_from_utf8(utf8_path); gchar *real_path = utils_get_real_path(locale_path);
@@ -245,14 +248,17 @@ static GSList *wb_project_dir_get_file_list(WB_PROJECT_DIR *root, const gchar *u
g_hash_table_insert(visited_paths, real_path, GINT_TO_POINTER(1));
- while (TRUE) + while ((child_name = g_dir_read_name(dir))) + children = g_slist_prepend(children, g_strdup(child_name)); + + g_dir_close(dir); + + foreach_slist(child, children) { const gchar *locale_name; gchar *locale_filename, *utf8_filename, *utf8_name;
- locale_name = g_dir_read_name(dir); - if (!locale_name) - break; + locale_name = child->data;
utf8_name = utils_get_utf8_from_locale(locale_name); locale_filename = g_build_filename(locale_path, locale_name, NULL); @@ -287,7 +293,7 @@ static GSList *wb_project_dir_get_file_list(WB_PROJECT_DIR *root, const gchar *u g_free(utf8_name); }
- g_dir_close(dir); + g_slist_free_full(children, g_free); g_free(locale_path);
return list;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).