[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sandboxed-tor-browser/master] Consume the cancel channel in various async tasks on return.



commit 2c013e8d052854760fab439651e721bd371f22eb
Author: Yawning Angel <yawning@xxxxxxxxxxxxxxx>
Date:   Sun Nov 27 21:03:11 2016 +0000

    Consume the cancel channel in various async tasks on return.
    
    This should make the various progress dialog cancel buttons more
    responsive.
---
 src/cmd/sandboxed-tor-browser/internal/ui/install.go | 3 +++
 src/cmd/sandboxed-tor-browser/internal/ui/launch.go  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/cmd/sandboxed-tor-browser/internal/ui/install.go b/src/cmd/sandboxed-tor-browser/internal/ui/install.go
index bc062f2..208e019 100644
--- a/src/cmd/sandboxed-tor-browser/internal/ui/install.go
+++ b/src/cmd/sandboxed-tor-browser/internal/ui/install.go
@@ -42,6 +42,9 @@ func (c *Common) DoInstall(async *Async) {
 	var err error
 	async.Err = nil
 	defer func() {
+		if len(async.Cancel) > 0 {
+			<- async.Cancel
+		}
 		if async.Err != nil {
 			log.Printf("install: Failing with error: %v", async.Err)
 		} else {
diff --git a/src/cmd/sandboxed-tor-browser/internal/ui/launch.go b/src/cmd/sandboxed-tor-browser/internal/ui/launch.go
index bb80ceb..56c0f54 100644
--- a/src/cmd/sandboxed-tor-browser/internal/ui/launch.go
+++ b/src/cmd/sandboxed-tor-browser/internal/ui/launch.go
@@ -31,6 +31,9 @@ import (
 func (c *Common) DoLaunch(async *Async, checkUpdates bool) {
 	async.Err = nil
 	defer func() {
+		if len(async.Cancel) > 0 {
+			<- async.Cancel
+		}
 		if async.Err != nil {
 			log.Printf("launch: Failing with error: %v", async.Err)
 			if c.tor != nil {

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits