Handle termination of rktwebview_prg through alive event mechanism.

This commit is contained in:
2026-04-11 16:51:02 +02:00
parent 7d2d3e0bd2
commit 40ad5a15a5

View File

@@ -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) (define (start-event-processing)
(thread (λ () (thread (λ ()
(letrec (letrec
@@ -589,9 +597,12 @@
_string*/utf-8)) _string*/utf-8))
) )
(rkt_webview_free_data rkt-evt) (rkt_webview_free_data rkt-evt)
(let ((cb (hash-ref evt-cb-hash wv #f))) ;(displayln (format "~a ~a" wv evt))
(unless (eq? cb #f) (if (= wv alive-error-event)
(cb evt)))))) (close-down-on-alive-error)
(let ((cb (hash-ref evt-cb-hash wv #f)))
(unless (eq? cb #f)
(cb evt)))))))
(set! waiting (- waiting 1)) (set! waiting (- waiting 1))
) )
) )
@@ -798,15 +809,25 @@
#f #f
#t))) #t)))
(define (rkt-webview-exit) (define (rkt-webview-exit . args)
(let ((open-windows (hash->list rkt-wv-store))) (let ((cl-w (if (null? args) #f (car args)))
(for-each (λ (kv) (msg (if (null? args) #f
(let ((win (car kv)) (if (null? (cdr args))
(handle (cdr kv))) #f
(rkt-webview-close handle))) (cadr args))))
open-windows)) )
(rkt_webview_cleanup) (when cl-w
(stop-event-processing) (let ((open-windows (hash->list rkt-wv-store)))
(for-each (λ (kv)
(let ((win (car kv))
(handle (cdr kv)))
(rkt-webview-close handle)))
open-windows)))
(rkt_webview_cleanup)
(unless (eq? msg #f)
(error msg))
)
(stop-event-processing)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;