Fix the VLISP/ActiveX object-management bug
There is a bug (probably in the VLISP/ActiveX bridging mechanism) that causes Autocad to become unstable if VLA-objects accessed through the ActiveX object model are not explicitly released. This means you can't use inline calls to Autocad entities in code like the following:
(vla-get-name (vla-item (vla-get-documents (vlax-get-acad-object)) myIndex))
This line of code does not maintain the reference to the various objects returned, so they cannot be explicitly released later. This may possibly be fixed by strategically-placed explicit calls to the garbage collector, but if so, this proceedure should be clearly documented.
At the very least, this bug should be noted in the documentation, in VERY CLEAR fashion, since it violates a central tenet of Lisp (that objects are garbage-collected, and do not need to be explicitly released). This bug has apparently existed ever since the introduction of VLISP, and it still isn't documented. I've found a lot of tales of woe caused by this bug...
RE: Fix the VLISP/ActiveX object-management bug
Oops, I should probably post a better example. I think the problem only crops up when using interface objects, as in the following example:
(setq curSurfName (vll-get-currentSurface (vll-get-surfaces (vll-get-activeProject aeccApp))))
Note the above line assumes the landauto.tlb is loaded with prefix "vll-", and aeccApp is the Civil Design application object retrived using:
(setq aeccApp (vla-getInterfaceObject (vlax-get-acad-object) "Aecc.Application"))
If you stay within the default vanilla-Autocad application, I don't *think* there's a problem...