05-05-2015 03:54 PM - edited 05-05-2015 03:57 PM
@Mitch_Peplow wrote:
Hi all,
Right I pinged an SR to NI ding the correct procedure to closing off references and this is their reply:
"Typically you would close the references in the reverse order you created them but I believe you are right in saying that destroying a reference does not destroy the actual object it is referencing and hence you should be able to use methods that were invoked from that object. I have had a discussion with several CLA's in the office and can confirm that for most functions you will be able to access the sub methods even if the parent class has had its reference destroyed"
That's true as long as the underlaying server component does correct ActiveX object refcounting, which is a pretty complicated matter to do absolutely correct, and sadly enough even many seasoned programmers tend to get that wrong sometimes. So while in theory the answer is right, in practice it could bite you in your a**, if the ActiveX component developer got the refcounting of the subobject wrong.
Therefore I do recommend to follow the rule of destrying the objects in reverse order of aquiring them, even if it SHOULD also work in any order!
05-05-2015 03:54 PM
@Mitch_Peplow wrote:
Hi all,
Right I pinged an SR to NI ding the correct procedure to closing off references and this is their reply:
"Typically you would close the references in the reverse order you created them but I believe you are right in saying that destroying a reference does not destroy the actual object it is referencing and hence you should be able to use methods that were invoked from that object. I have had a discussion with several CLA's in the office and can confirm that for most functions you will be able to access the sub methods even if the parent class has had its reference destroyed"
Hope this helps
Cheers
Mitch
That's true as long as the underlaying server component does correct ActiveX object refcounting, which is a pretty complicated matter to do absolutely correct, and sadly enough even many seasoned programmers tend to get wrong sometimes. So while in theory the answer is right, in practice it could bite you in your a**, if the ActiveX component developer got the refcounting of the subobject wrong.
Therefore I do recommend to follow the rule of destrying the objects in reverse order of aquiring them, even if it SHOULD also work in any order!