From e6d8488e84d597dfbbd54d43429dc3427ab14731 Mon Sep 17 00:00:00 2001 From: Mark Summerville Date: Tue, 20 Mar 2018 00:08:44 +0800 Subject: [PATCH] Fix for #362 --- TVRename#/ItemsAndActions/ActionCopyMoveRename.cs | 15 ++++++++++++--- TVRename#/ItemsAndActions/ActionItem.cs | 2 +- TVRename#/TVRename/TVDoc.cs | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/TVRename#/ItemsAndActions/ActionCopyMoveRename.cs b/TVRename#/ItemsAndActions/ActionCopyMoveRename.cs index 9b36a5e98..9840643cd 100644 --- a/TVRename#/ItemsAndActions/ActionCopyMoveRename.cs +++ b/TVRename#/ItemsAndActions/ActionCopyMoveRename.cs @@ -124,10 +124,19 @@ public override bool Go(ref bool pause, TVRenameStats stats) // ignored } - if (Operation == Op.Move && _tidyup != null && _tidyup.DeleteEmpty) + try { - logger.Info($"Testing {From.Directory.FullName } to see whether it should be tidied up"); - DoTidyup(From.Directory ); + if (Operation == Op.Move && _tidyup != null && _tidyup.DeleteEmpty) + { + logger.Info($"Testing {From.Directory.FullName} to see whether it should be tidied up"); + DoTidyup(From.Directory); + } + } + catch (Exception e) + { + Done = true; + Error = true; + ErrorText = e.Message; } return !Error; diff --git a/TVRename#/ItemsAndActions/ActionItem.cs b/TVRename#/ItemsAndActions/ActionItem.cs index 112358bc1..a00ab02ba 100644 --- a/TVRename#/ItemsAndActions/ActionItem.cs +++ b/TVRename#/ItemsAndActions/ActionItem.cs @@ -132,7 +132,7 @@ protected void DeleteOrRecycleFolder(DirectoryInfo di) else { logger.Info($"Deleting {di.FullName}"); - di.Delete(); + di.Delete(true,true); } } diff --git a/TVRename#/TVRename/TVDoc.cs b/TVRename#/TVRename/TVDoc.cs index d47b50908..f6854f84c 100644 --- a/TVRename#/TVRename/TVDoc.cs +++ b/TVRename#/TVRename/TVDoc.cs @@ -1698,6 +1698,9 @@ public void ActionProcessor(Object queuesIn) catch (Exception e) { logger.Fatal(e,"Unhandled Exception in ActionProcessor"); + foreach (Thread t in this.ActionWorkers) + t.Abort(); + this.WaitForAllActionThreadsAndTidyUp(); return; } }