Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reactor triggers fatal error

13 REPLIES 13
Reply
Message 1 of 14
FT398
606 Views, 13 Replies

Reactor triggers fatal error

OK, I'm fairly new to the world of reactors and have run into a problem which I'm hoping somebody can help me with.

 

I have created a very basic reactor as a test. As you can see, it doesn't actually do anything other than set a variable so I know the error isn't caused by something I'm doing with the reactor.

 

(defun np:test (reactor callbackdata / )
  (setq abc 123)
)
(if (not np:reactor1) 
  (setq np:reactor1 
    (vlr-command-reactor nil '((:vlr-commandwillstart . np:test)))
  )
)

 

 

OK, so the problem I have found is that if I load this reactor into a drawing and then use the MVSETUP command but escape out without completing the command, AutoCAD throws an error and becomes unusable. When I then close AutoCAD down I am met with multiple unhandled exception errors before the app finally closes.

 

I then altered the reactor from a vlr-command-reactor to a vlr-editor-reactor and found that with this, I am no longer met with the same error while escaping out of MVSETUP. However, when I close CAD down I am eventually left with an 'AutoCAD Application has stopped working' error dialog on screen which reports that acad.exe as crashed.

 

I am working on AutoCAD Architecture 2012 (although I have tried it on 2013 to with the same results) on Windows 7 64bit. I have also tried this on ACA2012 x32 and found the same error exists.

 

Is there anybody out there who can confirm whether they get the same errors as me or whether I am doing something fundamentally wrong in the way I am handling reactors?

13 REPLIES 13
Message 2 of 14
Moshe-A
in reply to: FT398

Hi,

 

 (defun np:test (reactor callbackdata / )
  (setq abc 123)
)
(if (not np:reactor1)
  (setq np:reactor1
    (vlr-command-reactor nil '((:vlr-commandwillstart . np:test)))
  )

 

 the only thing i found that might be a problem is the extra slash (in red)

otherwise it is working good

 

Moshe

 

 

 

Message 3 of 14
FT398
in reply to: FT398

Still crashes without - and that slash would normally be needed to clear out any localised variables in your reactor code. It's just that my example doesn't have any local variables in it for simplicity.

Message 4 of 14
Moshe-A
in reply to: FT398

Just to make sure...have you got other lisp files/programs that define more reactors?

Message 5 of 14
Moshe-A
in reply to: FT398

does the error occur also with other commans beside MVSETUP?

Message 6 of 14
FT398
in reply to: Moshe-A

I certainly have none of my own reactors. I have even tried a clean out-of-the-box install and tried this directly after install and still get the crash.

 

MVSETUP is the only command I have found that causes the error. A bit of testing has shown some odd behaviour with it. If I make a CommandCancelled reactor, this flags when I cancel any command EXCEPT when I cancel MVSETUP and this just seems to close quietly without triggering the reactor.

Message 7 of 14
Moshe-A
in reply to: FT398

sounds like a problem in MVSETUP on R2012

your code is good

 

Message 8 of 14
dbroad
in reply to: FT398

I can confirm that mvsetup triggers a fatal error if a command reactor with a :vlr-commandwillstart event is active.

 

Sounds like a bug. Have you reported it at autodesk.com/submitbug ?

Architect, Registered NC, VA, SC, & GA.
Message 9 of 14
FT398
in reply to: dbroad

I hadn't reported it yet as I wanted to make sure other people could replicate it and also that it wasn't down to me doing something wrong. I'll report the bug now and see if anything comes of it. In the meantime I need to find a way around this because while there are any CommandWillStart reactors loaded, it means that MVSETUP will always trigger this error.

Message 10 of 14
FT398
in reply to: FT398

Seems that the EDGE command also triggers the same fatal error. Interestingly, both of these routines are old legacy lisp routines so at least I may be able to pinpoint the trigger point within the files.

Message 11 of 14
FT398
in reply to: FT398

Found it.

 

It seems that the error is triggered by the use of command-s within the routines error handlers.

 

A search tells me that command-s appears in these files so presumably they will all be affected.

 

MVSETUP.lsp

EDGE.lsp

AI_UTILS.lsp

VL.arx

Message 12 of 14
Moshe-A
in reply to: FT398

Hi,

 

You mean they use (command) function?

i do not thing they made so essential changes to these command from previous releases

 

moshe

Message 13 of 14
FT398
in reply to: FT398

It seems that command-s was introduced in AutoCAD 2012. The MVSETUP and EDGE lisp routines which shipped with 2011 and earlier use 'command' and these versions do not trigger the fatal error. However, the use of command-s on 2012 and 2103 when a CommandWillStart reactor is loaded will trigger a fatal error.

 

Partial  error routine from Edge.lsp (2011)

 

(defun edge-er (n) 
  (if (/= s "Function cancelled") 
    (princ (strcat "\nError: " n))
  ) 
  (command) 
  (command "_.UCS" "_P")

 

Same section from Edge.lsp (2013)

 

(defun edge-er (n) 
  (setq *error* lisp-er)
  (if (/= s "Function cancelled") 
    (princ (strcat "\nError: " n))
  ) 
  (edge_setCmdEcho 0)
  (command-s "_.UCS" "_P") 

 

 

If you are running 2012/2013 then load the reactor from my original post and then use this command and you will get a fatal error:

 

(command-s "_.line" "0,0,0" "10,10,0" "")

Message 14 of 14
Ian_Bryant
in reply to: FT398

Yes you are right, using the command-s function causes Autocad to crash,
when a command reactor is loaded.
I eventually found a description of this function in 2013 help.
It says that the function runs in a temporary command processor
separate from the main Autocad command processor,
and gives an example of how improper use might crash Autocad.
- using (command-s "U") while an ordinary command is active.
It would appear that they forgot to consider how the function
would handle command reactors.
Ian

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost