Menu

#75 CLIPS crashes when overloaded specific method is called.

1.0
closed
None
2024-02-18
2024-01-28
xyando
No

Hello,

The following commands makes CLIPS to crash.

(defmethod init-slots((?x STRING)) )
(defmethod delete-instance((?x STRING)) )
(defmethod ppinstance((?x STRING)) )

(defclass FOO (is-a USER))

(defmessage-handler FOO doit()
  (init-slots)
  (delete-instance)
  (ppinstance)
)

(make-instance [a] of FOO)
(send [a] doit)

The patch attached seems to fix this problem.
Thanks.

1 Attachments

Discussion

  • Gary Riley

    Gary Riley - 2024-02-10

    Fix checked in. The behavior of a method overriding a function that can only be called from a message-handler is now consistent with the behavior for a deffunction or non-overriding method.

    CLIPS> (clear)
    CLIPS> (deffunction ppi () (ppinstance))
    CLIPS> (defclass FOO (is-a USER))
    CLIPS> 
    (defmessage-handler FOO doit()
      (ppi))
    CLIPS> (make-instance [a] of FOO)
    [a]
    CLIPS> (send [a] doit)
    [MSGFUN4] The function 'ppinstance' may only be called from within message-handlers.
    [PRCCODE4] Execution halted during the actions of deffunction 'ppi'.
    [PRCCODE4] Execution halted during the actions of message-handler 'doit' primary in class 'FOO'
    FALSE
    CLIPS>
    
    CLIPS> (clear)
    CLIPS> (defmethod ppi () (ppinstance))
    CLIPS> (defclass FOO (is-a USER))
    CLIPS> 
    (defmessage-handler FOO doit()
      (ppi))
    CLIPS> (make-instance [a] of FOO)
    [a]
    CLIPS> (send [a] doit)
    [MSGFUN4] The function 'ppinstance' may only be called from within message-handlers.
    [PRCCODE4] Execution halted during the actions of generic function 'ppi' method #1.
    [PRCCODE4] Execution halted during the actions of message-handler 'doit' primary in class 'FOO'
    FALSE
    CLIPS>
    
    CLIPS> (clear)
    CLIPS> (defmethod ppinstance ((?x STRING)))
    CLIPS> (defclass FOO (is-a USER))
    CLIPS> 
    (defmessage-handler FOO doit()
      (ppinstance))
    CLIPS> (make-instance [a] of FOO)
    [a]
    CLIPS> (send [a] doit)
    [MSGFUN4] The function 'ppinstance' may only be called from within message-handlers.
    [PRCCODE4] Execution halted during the actions of message-handler 'doit' primary in class 'FOO'
    FALSE
    CLIPS> 
    
     
  • Gary Riley

    Gary Riley - 2024-02-10
    • status: new --> closed
    • assigned_to: Gary Riley
     
  • xyando

    xyando - 2024-02-18

    It looks fine, Thanks.

     

Log in to post a comment.