Handle termination of rktwebview_prg through alive event mechanism.
This commit is contained in:
@@ -569,6 +569,14 @@
|
||||
)
|
||||
|#
|
||||
|
||||
(define alive-error-event -94328)
|
||||
|
||||
(define (close-down-on-alive-error)
|
||||
(rkt-webview-exit #f
|
||||
"rktwebview_prg has stopped working, cannot continue"
|
||||
) ; close without closing windows
|
||||
)
|
||||
|
||||
(define (start-event-processing)
|
||||
(thread (λ ()
|
||||
(letrec
|
||||
@@ -589,9 +597,12 @@
|
||||
_string*/utf-8))
|
||||
)
|
||||
(rkt_webview_free_data rkt-evt)
|
||||
;(displayln (format "~a ~a" wv evt))
|
||||
(if (= wv alive-error-event)
|
||||
(close-down-on-alive-error)
|
||||
(let ((cb (hash-ref evt-cb-hash wv #f)))
|
||||
(unless (eq? cb #f)
|
||||
(cb evt))))))
|
||||
(cb evt)))))))
|
||||
(set! waiting (- waiting 1))
|
||||
)
|
||||
)
|
||||
@@ -798,14 +809,24 @@
|
||||
#f
|
||||
#t)))
|
||||
|
||||
(define (rkt-webview-exit)
|
||||
(define (rkt-webview-exit . args)
|
||||
(let ((cl-w (if (null? args) #f (car args)))
|
||||
(msg (if (null? args) #f
|
||||
(if (null? (cdr args))
|
||||
#f
|
||||
(cadr args))))
|
||||
)
|
||||
(when cl-w
|
||||
(let ((open-windows (hash->list rkt-wv-store)))
|
||||
(for-each (λ (kv)
|
||||
(let ((win (car kv))
|
||||
(handle (cdr kv)))
|
||||
(rkt-webview-close handle)))
|
||||
open-windows))
|
||||
open-windows)))
|
||||
(rkt_webview_cleanup)
|
||||
(unless (eq? msg #f)
|
||||
(error msg))
|
||||
)
|
||||
(stop-event-processing)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user