From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

QControl Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing control reference?

Solved!
Go to solution

Does the control reference fed to the Qcontrol ever get closed somewhere? I see where the State data and event handler are closed, but it looks like the reference is left open. Is that correct? If so, is it intentional?

Message 1 of 4
(3,470 Views)
Solution
Accepted by BertMcMahan

Control references never need to be closed. More generally, nothing that inherits from GObject ever needs to be closed. LabVIEW manages those references internally, and trying to close them is a no-op.

 

See my Brainless LabVIEW presentation for more info.

Message 2 of 4
(3,469 Views)

Ah TIL! I usually try to rabidly close references because that's the "conventional wisdom"- when you open a reference somewhere, you must close it elsewhere. I'd assumed most of these references worked the same way as, say, a queue reference worked, where each "obtain reference" was unique.

 

Thanks for that presentation, it's very informative. I need me one of those mousepads 😉

0 Kudos
Message 3 of 4
(3,466 Views)

On a similar note, it is best to always use the Close method on every QControl.  However, if you forget, I did make it smart enough that the orphaned Event Handler would be stopped automatically as to not hang your application.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



Message 4 of 4
(3,448 Views)