diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 1624da4..efe6444 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -79,7 +79,8 @@ (with-accessors ((fetching-thread fetching-thread)) object (abort-downloading object) (when (bt:threadp fetching-thread) - (bt:join-thread fetching-thread)))) + (bt:join-thread fetching-thread))) + object) (defmethod stop-stream-thread ((object string)) (let ((stream-wrapper (find-db-stream-url object))) @@ -444,7 +445,9 @@ (clean-gemtext main-window) (set-text-gemtext main-window lines))))) ((fs:directory-exists-p path) - (gui:choose-directory :initial-dir path :parent main-window :mustexist t)))) + (gui:choose-directory :initial-dir path :parent main-window :mustexist t)) + (t + (notify-request-error (format nil (_ "No such file or directory: ~a") path))))) (defun open-iri (iri main-window use-cache) (handler-case @@ -495,13 +498,21 @@ ((gemini-client:header-success-p status-code) (cond ((eq status +stream-status-streaming+) - (maybe-stop-steaming-stream-thread) - (clean-gemtext main-window) - (start-streaming-thread iri - :use-cache nil - :process-function (lambda (lines) - (collect-ir-lines iri main-window lines)) - :status status)) + (let ((stopped-stream (maybe-stop-steaming-stream-thread))) + (clean-gemtext main-window) + (start-streaming-thread iri + :use-cache nil + :process-function + (lambda (lines) + ;; this test ensures that the + ;; collecting events left on + ;; the queue won't be actually + ;; processed, just discarded + (when (and stopped-stream + (not (eq (status stopped-stream) + +stream-status-canceled+))) + (collect-ir-lines iri main-window lines))) + :status status))) ((eq status +stream-status-downloading+) (when (not (find-db-stream-url iri)) (enqueue-request-notify-error :gemini-request 1 iri use-cache)))