Use WebView’s stopLoading instead of killing the running task

This is a more appropriate API to use for signalling that we wish to abort the running command.
This commit is contained in:
Allan Odgaard
2016-08-14 11:17:25 +02:00
parent c1a8ea734e
commit f773bb3738
3 changed files with 4 additions and 6 deletions

View File

@@ -19,7 +19,6 @@
#import <HTMLOutputWindow/HTMLOutputWindow.h>
#import <OakFilterList/FileChooser.h>
#import <OakSystem/application.h>
#import <OakSystem/process.h>
#import <Find/Find.h>
#import <BundlesManager/BundlesManager.h>
#import <network/network.h>
@@ -652,7 +651,7 @@ namespace
OakShowAlertForWindow(alert, self.window, ^(NSInteger returnCode){
if(returnCode == NSAlertDefaultReturn) /* "Stop" */
{
oak::kill_process_group_in_background(_runner->process_id());
[_htmlOutputView stopLoading];
_runner.reset();
[sender performSelector:@selector(performClose:) withObject:self afterDelay:0];
}
@@ -1290,7 +1289,7 @@ namespace
auto sheetResponseHandler = ^(NSInteger returnCode){
if(returnCode == NSAlertDefaultReturn) /* "Stop" */
{
oak::kill_process_group_in_background(candidate.commandRunner->process_id());
[candidate.htmlOutputView stopLoading];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
candidate.commandRunner->wait_for_command(); // Must not be called in main queue
dispatch_async(dispatch_get_main_queue(), ^{

View File

@@ -1,7 +1,6 @@
#import "HTMLOutputWindow.h"
#import <OakAppKit/OakAppKit.h>
#import <OakFoundation/NSString Additions.h>
#import <OakSystem/process.h>
#import <command/runner.h>
#import <oak/debug.h>
@@ -108,7 +107,7 @@ OAK_DEBUG_VAR(HTMLOutputWindow);
if(returnCode == NSAlertDefaultReturn) /* "Stop" */
{
[self.window orderOut:self];
oak::kill_process_group_in_background(_commandRunner->process_id());
[self.htmlOutputView stopLoading];
[self.window close];
}
});

View File

@@ -1,4 +1,4 @@
SOURCES = src/*.mm
EXPORT = src/HTMLOutputWindow.h
LINK += HTMLOutput OakAppKit OakFoundation OakSystem command
LINK += HTMLOutput OakAppKit OakFoundation command
FRAMEWORKS = Cocoa