diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-09 10:39:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-09 10:39:16 +0000 |
commit | f6b7583d1ad7b2eb8e9103216c5f9209d3ba9c74 (patch) | |
tree | 42f91f3fa5258c4f07244edf43543d9df20641cb | |
parent | fa12278188a9dcafac112ed3505430be558704ae (diff) | |
download | gnunet-gtk-f6b7583d1ad7b2eb8e9103216c5f9209d3ba9c74.tar.gz gnunet-gtk-f6b7583d1ad7b2eb8e9103216c5f9209d3ba9c74.zip |
-fixing #2139
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-dialog.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index 074a1ad1..0c609fdf 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c | |||
@@ -201,6 +201,11 @@ struct AddDirClientContext | |||
201 | struct GNUNET_FS_DirScanner *ds; | 201 | struct GNUNET_FS_DirScanner *ds; |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * Task scheduled to stop the scanner on errors. | ||
205 | */ | ||
206 | GNUNET_SCHEDULER_TaskIdentifier kill_task; | ||
207 | |||
208 | /** | ||
204 | * Default options to use for sharing when adding files during the scan. | 209 | * Default options to use for sharing when adding files during the scan. |
205 | */ | 210 | */ |
206 | struct GNUNET_FS_BlockOptions directory_scan_bo; | 211 | struct GNUNET_FS_BlockOptions directory_scan_bo; |
@@ -905,6 +910,11 @@ static void | |||
905 | destroy_progress_dialog (struct AddDirClientContext *adcc) | 910 | destroy_progress_dialog (struct AddDirClientContext *adcc) |
906 | { | 911 | { |
907 | GNUNET_assert (NULL == adcc->ds); | 912 | GNUNET_assert (NULL == adcc->ds); |
913 | if (GNUNET_SCHEDULER_NO_TASK != adcc->kill_task) | ||
914 | { | ||
915 | GNUNET_SCHEDULER_cancel (adcc->kill_task); | ||
916 | adcc->kill_task = GNUNET_SCHEDULER_NO_TASK; | ||
917 | } | ||
908 | gtk_widget_destroy (adcc->progress_dialog); | 918 | gtk_widget_destroy (adcc->progress_dialog); |
909 | g_object_unref (G_OBJECT (adcc->progress_dialog_builder)); | 919 | g_object_unref (G_OBJECT (adcc->progress_dialog_builder)); |
910 | GNUNET_CONTAINER_DLL_remove (adcc->ctx->adddir_head, | 920 | GNUNET_CONTAINER_DLL_remove (adcc->ctx->adddir_head, |
@@ -1087,6 +1097,26 @@ add_share_items_to_treestore (struct AddDirClientContext *adcc, | |||
1087 | 1097 | ||
1088 | 1098 | ||
1089 | /** | 1099 | /** |
1100 | * Function called when the scanner had some trouble and we | ||
1101 | * need to abort the scanning process (which we need to do | ||
1102 | * in a separate task). | ||
1103 | * | ||
1104 | * @param cls progress dialog context of our window | ||
1105 | * @param tc scheduler context, unused | ||
1106 | */ | ||
1107 | static void | ||
1108 | stop_scanner_task (void *cls, | ||
1109 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1110 | { | ||
1111 | struct AddDirClientContext *adcc = cls; | ||
1112 | |||
1113 | adcc->kill_task = GNUNET_SCHEDULER_NO_TASK; | ||
1114 | GNUNET_FS_directory_scan_abort (adcc->ds); | ||
1115 | adcc->ds = NULL; | ||
1116 | } | ||
1117 | |||
1118 | |||
1119 | /** | ||
1090 | * Progress callback called from the directory scanner with | 1120 | * Progress callback called from the directory scanner with |
1091 | * information about our progress scanning the hierarchy. | 1121 | * information about our progress scanning the hierarchy. |
1092 | * | 1122 | * |
@@ -1174,8 +1204,7 @@ directory_scan_cb (void *cls, | |||
1174 | break; | 1204 | break; |
1175 | case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR: | 1205 | case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR: |
1176 | insert_progress_dialog_text (adcc, _("Operation failed (press cancel)\n")); | 1206 | insert_progress_dialog_text (adcc, _("Operation failed (press cancel)\n")); |
1177 | GNUNET_FS_directory_scan_abort (adcc->ds); | 1207 | adcc->kill_task = GNUNET_SCHEDULER_add_now (&stop_scanner_task, adcc); |
1178 | adcc->ds = NULL; | ||
1179 | break; | 1208 | break; |
1180 | case GNUNET_FS_DIRSCANNER_FINISHED: | 1209 | case GNUNET_FS_DIRSCANNER_FINISHED: |
1181 | { | 1210 | { |