Another attempt on quitting cleanly
This commit is contained in:
@@ -587,14 +587,15 @@
|
||||
(let ((waiting (sync events-channel)))
|
||||
(if (= waiting evt-guard-stop)
|
||||
(begin
|
||||
(displayln "got evt-guard-stop, exiting event processing")
|
||||
(info-webview "got evt-guard-stop, exiting event processing")
|
||||
(set! evt-processing-thread #f)
|
||||
evt-guard-stop)
|
||||
(begin
|
||||
(set! waiting (rkt_webview_events_waiting))
|
||||
(while (> waiting 0)
|
||||
(let* ((rkt-evt (rkt_webview_get_event)))
|
||||
(if (eq? rkt-evt #f)
|
||||
(displayln (format "Unexpected: event = nullptr"))
|
||||
(err-webview (format "Unexpected: event = nullptr"))
|
||||
(let* ((data (rkt_data_t-data rkt-evt))
|
||||
(e (union-ref data 1))
|
||||
(wv (rkt_evt_t-w e))
|
||||
@@ -622,7 +623,9 @@
|
||||
(define evt-processing-thread (start-event-processing))
|
||||
|
||||
(define (stop-event-processing)
|
||||
(kill-thread evt-processing-thread))
|
||||
(unless (eq? evt-processing-thread #f)
|
||||
(kill-thread evt-processing-thread))
|
||||
(set! evt-processing-thread #f))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Provided features
|
||||
@@ -822,7 +825,7 @@
|
||||
|
||||
|
||||
(define (rkt-webview-finalizer rkt-wv-store close-windows message)
|
||||
(displayln "rkt-webview-finalizer active")
|
||||
(dbg-webview "rkt-webview-finalizer active")
|
||||
(when close-windows
|
||||
(let ((open-windows (hash->list rkt-wv-store)))
|
||||
(for-each (λ (kv)
|
||||
@@ -830,14 +833,15 @@
|
||||
(handle (cdr kv)))
|
||||
(rkt-webview-close handle)))
|
||||
open-windows)))
|
||||
(displayln "Sending guard-stop message to event callback")
|
||||
(dbg-webview "Sending guard-stop message to event callback")
|
||||
;(sleep 0.5)
|
||||
(event-callback evt-guard-stop)
|
||||
(displayln "Cleaning up FFI library")
|
||||
(dbg-webview "Cleaning up FFI library")
|
||||
(rkt_webview_cleanup)
|
||||
(unless (eq? message #f) (error message))
|
||||
(displayln "Stopping event processing thread (kill-thread)")
|
||||
(dbg-webview "Stopping event processing thread (kill-thread)")
|
||||
(stop-event-processing)
|
||||
(displayln "Finalizer done")
|
||||
(dbg-webview "Finalizer done")
|
||||
)
|
||||
|
||||
(define (rkt-webview-exit . args)
|
||||
|
||||
Reference in New Issue
Block a user