mirror of
https://github.com/open-goal/jak-project
synced 2026-06-11 21:19:11 -04:00
Check that we have valid process before invoking event-hook (fix jak1 qbert crash) (#4006)
More info in #4005, which this fixes
This commit is contained in:
@@ -399,7 +399,11 @@ It type checks the arguments for the entry function.
|
||||
(defun send-event-function ((proc process-tree) (msg event-message-block))
|
||||
"Function to send an event to a process. Please use the send-event macros when possible"
|
||||
(with-pp
|
||||
(when (and proc (!= (-> proc type) process-tree) (-> (the process proc) event-hook))
|
||||
;; og:preserve-this check that we have a _valid_ process. originally this just checked
|
||||
;; that type != process-tree, but sometimes we might get stale process ref (qbert-plat-master)
|
||||
(when (and (valid? proc process #f #f 0)
|
||||
(nonzero? (-> (the process proc) pid))
|
||||
(-> (the process proc) event-hook))
|
||||
(let ((pp-backup pp))
|
||||
(set! pp (the process proc))
|
||||
(let ((result ((-> (the process proc) event-hook) (-> msg from) (-> msg num-params) (-> msg message) msg)))
|
||||
|
||||
@@ -501,7 +501,11 @@ It type checks the arguments for the entry function.
|
||||
(defun send-event-function ((arg0 process-tree) (arg1 event-message-block))
|
||||
"Send an event block to a process."
|
||||
(with-pp
|
||||
(when (and arg0 (!= (-> arg0 type) process-tree) (-> (the-as process arg0) event-hook) (-> arg1 from))
|
||||
;; og:preserve-this check that we have a _valid_ process. originally this just checked
|
||||
;; that type != process-tree, but sometimes we might get stale process ref (jak1 qbert-plat-master)
|
||||
(when (and (valid? arg0 process (the-as string #f) #f 0)
|
||||
(nonzero? (-> (the-as process arg0) pid))
|
||||
(-> (the-as process arg0) event-hook) (-> arg1 from))
|
||||
(let ((gp-0 pp))
|
||||
(set! pp (the-as process arg0))
|
||||
(let ((v0-0 ((-> (the-as process arg0) event-hook) (-> arg1 from 0) (-> arg1 num-params) (-> arg1 message) arg1)))
|
||||
|
||||
@@ -461,7 +461,11 @@
|
||||
|
||||
(defun send-event-function ((arg0 process-tree) (arg1 event-message-block))
|
||||
(with-pp
|
||||
(when (and arg0 (!= (-> arg0 type) process-tree) (-> (the-as process arg0) event-hook) (-> arg1 from))
|
||||
;; og:preserve-this check that we have a _valid_ process. originally this just checked
|
||||
;; that type != process-tree, but sometimes we might get stale process ref (jak1 qbert-plat-master)
|
||||
(when (and (valid? arg0 process (the-as string #f) #f 0)
|
||||
(nonzero? (-> (the-as process arg0) pid))
|
||||
(-> (the-as process arg0) event-hook) (-> arg1 from))
|
||||
(let ((gp-0 pp))
|
||||
(set! pp (the-as process arg0))
|
||||
(let ((v0-0 ((-> (the-as process arg0) event-hook) (-> arg1 from 0) (-> arg1 num-params) (-> arg1 message) arg1)))
|
||||
|
||||
Reference in New Issue
Block a user