LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disappearing References

Okay so here's my weird error (bug?)

I'm using LV 8.0.

I'm trying to write a shell to help a large program that has many subpanels. The idea is that the shell has the only front panel seen and when a program wants to show a new front panel it has the shell subpanel it in and then runs the VI.

So my problem is that nothing seems to work more than once! I've attached a zip with an example highlighting my problem.

You run Main.vi, and it will launch the shell and close itself, the shell will then subpanel in main and run it. So from there you can click any of the buttons to subpanel in another VI.

My problem comes from... say you click VI 1, then click Go Back, then click VI 1 again, you get an error. If you investigate a little, you'll see that the VI reference that it's passing is suddenly invalid.

Another weird thing is that if you kill the shell and reopen Main, and kill that too (lots of killing), you'll notice that VI 1 is still running even though nothing about it is still open or calling it or anything.

(I promise this all makes more sense when you look at the attached example)

What's going on??
0 Kudos
Message 1 of 4
(2,861 Views)
Hi wpolk,
      The answer to your questions follow, and after that, a less complicated alternative. Smiley Wink


Another weird thing is that if you kill the shell and reopen Main, and kill that too (lots of killing), you'll notice that VI 1 is still running even though nothing about it is still open or calling it or anything.

In Main, where Shell is called during Startup, Auto-dispose is set to false, set it to TRUE!  When opening VIs (like Shell) dynamically, it's very important to close the refernces, else they can become "orphaned" processes, continuing to allocate resources (and their children will behave as if they're active.)


You run Main.vi, and it will launch the shell and close itself,...

Comment: This is very awkward - are you sure we can't have shell call Main to start with?
 


My problem comes from... say you click VI 1, then click Go Back, then click VI 1 again, you get an error. If you investigate a little, you'll see that the VI reference that it's passing is suddenly invalid.

The problem was in Shell.  It Closed Main then ran it using the same reference.  Turns out, the reference was invalid after that and that's why you couldn't return to Main from V1.  Changing the logic to Open a new reference helped a lot!
 
 
The zipped code still has bugs, but instead of continuing to supporting this method, please consider the alternative also attached. Making a class-like SubPanel-driver allows SubVIs to register themselves.
 
Cheers! 
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Download All
Message 2 of 4
(2,821 Views)
What do you mean when you say:

Making a class-like SubPanel-driver allows SubVIs to register themselves?
0 Kudos
Message 3 of 4
(2,756 Views)
Hi wpolk,

@wpolk wrote:
What do you mean when you say:

Making a class-like SubPanel-driver allows SubVIs to register themselves?


Well, I could have left-off the "class-like" - though that's the way I think of these little "drivers" that encapsulate object properties and functions - they represent the object (in this case the Shell SubPanel) within the application. Smiley Happy

It's not necessary for Main to send a Notifier to the Shell at the same time that Main launches a SubVI - why not let a SubVI can make itself visible (in Shell) by calling the "Register" Function on the "SubPanel-driver"?

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 4 of 4
(2,738 Views)