[gnac/devel] Fixed a concurrency bug
- From: Benoît Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/devel] Fixed a concurrency bug
- Date: Wed, 9 Jun 2010 07:55:22 +0000 (UTC)
commit 392ec063c5a29da0e0c3a992f42c4c3dd54a9cd5
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Wed Jun 9 08:54:15 2010 +0100
Fixed a concurrency bug
src/gnac-main.c | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/src/gnac-main.c b/src/gnac-main.c
index ec3b599..28879ed 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -290,29 +290,39 @@ gnac_files_names_list_foreach(gpointer data,
static void
gnac_add_files_thread_entry(gpointer data)
{
- GSList *files;
+ static GSList *files;
gchar *files_added_text;
-
+
+ /* If we are already adding files, simply update the list */
+ if (files) {
+ files = g_slist_concat(files, (GSList*)data);
+ return;
+ }
+
gdk_threads_enter();
- gnac_file_list_attach_default_model(FALSE);
- gnac_ui_push_status(_("Importing files..."));
- gdk_flush();
+ gnac_file_list_attach_default_model(FALSE);
+ gnac_ui_push_status(_("Importing files..."));
gdk_threads_leave();
+
files = (GSList*) data;
nb_files_added = 0;
- g_slist_foreach(files, (GFunc) gnac_files_names_list_foreach, NULL);
+ while (files) {
+ gnac_files_names_list_foreach(files->data, NULL);
+ files = g_slist_next(files);
+ }
g_slist_free(files);
+
if (!quit_app) {
gdk_threads_enter();
- gnac_ui_set_progress_text("");
- gnac_file_list_attach_default_model(TRUE);
- gnac_change_state(GNAC_AUDIO_READY_STATE);
- files_added_text = g_strdup_printf(
- ngettext("%u file imported", "%u files imported", nb_files_added), nb_files_added);
- gnac_ui_push_status(files_added_text);
- g_free(files_added_text);
- file_action_thread = NULL;
- gdk_flush();
+ gnac_ui_set_progress_text("");
+ gnac_file_list_attach_default_model(TRUE);
+ gnac_change_state(GNAC_AUDIO_READY_STATE);
+ files_added_text = g_strdup_printf(
+ ngettext("%u file imported", "%u files imported", nb_files_added),
+ nb_files_added);
+ gnac_ui_push_status(files_added_text);
+ g_free(files_added_text);
+ file_action_thread = NULL;
gdk_threads_leave();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]