Skip to content

Commit

Permalink
more cancel checks
Browse files Browse the repository at this point in the history
  • Loading branch information
n00mkrad committed Aug 22, 2021
1 parent 5c4fcd0 commit 7a191d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Code/Main/PostProcessingQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static async Task ProcessQueue ()
{
Stopwatch sw = new Stopwatch();

while (run || AnyFilesLeft())
while (!Program.canceled && (run || AnyFilesLeft()))
{
if (outputFileQueue.Count > 0)
{
Expand Down
2 changes: 2 additions & 0 deletions Code/Main/Upscale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ public static ModelData GetModelData()

public static string FilenamePostprocess(string file)
{
if (Program.canceled) return null;

try
{
string newFilename = file;
Expand Down
3 changes: 1 addition & 2 deletions Code/UI/PreviewUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ public static async Task UpscaleImage()
try
{
await Upscale.Run(Paths.imgInPath, Paths.imgOutPath, mdl, false, Config.GetBool("alpha"), PreviewUi.PreviewMode.None);

if (Program.canceled) return;
outImg = Upscale.GetOutputImg();

Program.mainForm.SetProgress(100f, "Post-Processing...");
await Task.Delay(50);
await PostProcessing.PostprocessingSingle(outImg, false);
Expand Down

0 comments on commit 7a191d8

Please sign in to comment.