diff --git a/bar.go b/bar.go index db8a350..cbb78ca 100644 --- a/bar.go +++ b/bar.go @@ -342,11 +342,15 @@ reader, lines = s.extender(nil, s.reqWidth, stat) b.recoveredPanic = p } - b.frameCh <- &frame{ + frame := frame{ reader: reader, lines: lines + 1, shutdown: s.completed || s.aborted, } + if frame.shutdown { + b.cancel() + } + b.frameCh <- &frame }() if b.recoveredPanic == nil { reader = s.draw(stat) diff --git a/progress.go b/progress.go index d91fc55..c0210ef 100644 --- a/progress.go +++ b/progress.go @@ -269,7 +269,6 @@ return err } if frame.shutdown { - b.cancel() <-b.done // waiting for b.done, so it's safe to read b.bs var toDrop bool if qb, ok := s.queueBars[b]; ok {