LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to determine if a vi is running in a subpanel?


@BertMcMahan wrote:

wiebe@CARYA wrote:


 

In normal programming, I always provide a subpanel to a sub VI, so the sub VI can insert\remove itself. This is (or used to be) the only reliable way to make LabVIEW not crash when recursively inserting clones in subpanels. Closing a clone with a subpanel with a clone in it used to be very unreliable. Perhaps it still is.

I know this is an old thread- but could you expound on this? I have an issue with bizarre RTE crashes, and am using nested subpanels (3 deep, IIRC). My crashes seem to happen around the same time I'm loading and unloading new VI's (AF Actors, so dynamic dispatch clones) into subpanels, so it's either loading a VI, unloading it, or something to do with the subpanel.


Basically I make sure the ordering of removing from subpanels and closing it's clone reference is deterministic.

 

There's a problem (obviously a rather complex one, there might be many factors I don't even know about) with removing a FP from a subpanel after all references have been closed (except the one that LV keeps open for the subpanel). So when VI A is in a subpanel in VI B, when A references are closed but still in A, there are problems when A closes. A will (apparently) dispose it's subpanel and the Vi in it, but that's a clone without any references and there could be crashes.

 

I also recall the crashes would increase if with (mouse) events during all this closing and removing from subpanels. Maybe when catching those events in an event structure in either or both A and B.

 

And all this is recursive, so there's not just A and B, but A, B, C, D...

 

I haven't tried to get the problem back in recent LV versions. Simply because I don't want the problem back and it's a lot of work 🙄.

0 Kudos
Message 31 of 32
(242 Views)

I did a bit of trial and error on this (posted in my other thread here https://forums.ni.com/t5/Actor-Framework-Discussions/MGI-Panel-Actor-potential-crash/m-p/4344991#M77...).

 

It looks like the reference that LabVIEW keeps for the VI inside the subpanel is NOT the same one you wire to "Insert into subpanel". It appears to make a new one and only use that.

 

You can demonstrate this by calling the "Inserted VI" property node, then closing that reference. If you call Remove VI after that, the subpanel stops working right and just shows some glitched graphics.

 

Additionally, the "Inserted VI" node does NOT get a fresh reference every time you call it, it just grabs the same one each time, even if you close the reference externally.

0 Kudos
Message 32 of 32
(221 Views)