PDA

View Full Version : vlax-release-object


pnorman
2005-06-09, 03:26 AM
Is it necessary to use vlax-release-object if the object name is stored in a local symbol?

For example:


(defun ppn_set_activedimstyle (my_dimstyle / my_dimstyle_ob)
(if (tblsearch "dimstyle" my_dimstyle)
(progn
(setq my_dimstyle_ob (vla-item (vla-get-dimstyles (active-document)) my_dimstyle))
(vla-put-activedimstyle (active-document) my_dimstyle_ob)
(vlax-release-object my_dimstyle_ob) ;IS THIS LINE NECESSARY????????
)
)
)


Thanks

RobertB
2005-06-09, 07:21 AM
The answer is, it depends. Some objects need to be released while others don't seem to care. Objects that need to be released (in 2005 and earlier) are the menu objects, for example, or objects that have change object types do to operations such as break.

sinc
2005-06-13, 06:30 PM
You are best off releasing all vla-objects explicitly. In theory, you shouldn't need to, but I don't think the Lisp-ActiveX bridge was implemented properly, and there seem to be the odd bugs here and there. It's a pain, I know, but then again, Lisp wasn't designed as an object-oriented language.

From Autodesk's actions, I'm guessing the whole Lisp interface is in the process of being deprecated in favor of the .Net stuff, in part due to issues like this. (Just a guess based on behavior; I have no inside knowledge.)