LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Password control crashes CVI

I have a Windows XP system that after using the password control to enter a password, program will crash when it calls the next DiscardPanel function. The program has a popup requesting a password and then calls RemovePopup after which all works fine. When the program calls DiscardPanel after this it crashes (discarding another panel). I've installed the development system to pinpoint the problem and it stops on DiscardPanel with an "Unknown Error" message. Also tried calling DiscardCtrl first and then crashes on that. If I comment out the password control calls and treat the popup as a "normal" popup everything works fine. Any other PC I've tried works fine and doesn't have this issue? Made sure this system has all the latest Windows updates and no difference. I will probably just have to use a new PC, but would like to fix the problem to avoid having it happen again.

0 Kudos
Message 1 of 20
(4,897 Views)
Cvi should havo no problem in using the password control: it's a very stable custom control. What you could see is to check you have the same rte as the system the application is developed on. Are you using anything special in that popup? Could you post the relevant code?


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 20
(4,880 Views)

I've attached the code for a simple program that exibits the problem on my one PC. The first uir file is just a blank panel and second has a command button that calls the EnterPassword function. When it executes the DiscardCtrl function it cause the unknown error message. The original program would check the password returned and if correct would close the second uir file by calling DiscardPanel and would generate the same unknown error. I have three other systems here and works fine on all three, just the one that does this. I've installed CVI 2013 version 13.0.1 and still does it.

0 Kudos
Message 3 of 20
(4,862 Views)

I tried reproducing the error with the example you provided, but I wasn't able to, neither in the DiscardCtrl call nor in the DiscardPanel function at the end of main. I'm attaching my project here, including the UI, so that you can confirm that it should be the same as yours. Let me know if you can see the error with this one.

 

One thing you have to careful about, when using custom controls, is that you never directly modify the callback function or callback data of the control, after you convert the base control into a custom control. I don't see you doing that in your code snippet, but I don't know if you might be doing it elsewhere in your program.

 

Luis

Message 4 of 20
(4,844 Views)

I've only been able to reproduce it on the one PC. Everything else works fine on that PC and actually there ins't much on it. If I comment out the password control lines and treat it like a plain popup then no problem with it. Once I enable the password control code it crashes with the unknown error message every time. If I take the same program and run it on all my other systems it runs without error which is what you observed. I've uninstalled and reinstalled CVI and still crashes. If I run it as an exe (not debug mode) then crashes too.

0 Kudos
Message 5 of 20
(4,833 Views)

So, I take it that the project that I attached above also always crashes in that one PC, and never crashes in the other PCs?

 

When you run it outside of CVI, what exactly does the crash dialog say? Does it report any memory address associated with the crash?

 

Finally, on the off chance that the crash is happening in the custom control itself, when you run the project in CVI you should try adding the pwctrl.c and toolbox.c source files to your project, in order to increase the likelihood of the debugger giving you a better source position for the crash.

 

Luis

Message 6 of 20
(4,830 Views)

Yes I get the same thing with your program. I should have thought of attaching the password control. I've attached an error text file. First line is the error message I get. Second section is the routine where it fails on the UnchainCtrlCallback line. Hope that helps.

0 Kudos
Message 7 of 20
(4,824 Views)

That source position (c:\...\CVI2013\toolslib\custctrl\pwctrl.c, line 146) indicates that the crash is in the UnchainCtrlCallback function, which is a toolbox function. Did you also add toolbox.c to your project? If so, you should be able to step into it and debug it, to see where exactly the crash is coming from.

Message 8 of 20
(4,815 Views)

Didn't figure out how to attach the toolbox because it was already loaded. Finally figured to cut it and restart CVI so I could add it as an instrument. Takes quite a bit of time to compile it, but when I do it this way it runs fine? Even set a breakpoint and stepped through the code without seeing anything.

0 Kudos
Message 9 of 20
(4,793 Views)

Hmm... that makes things a bit challenging.

 

One thing you can try is to add some DebugPrintf calls to the UnchainCtrlCallback function to see how far you can get when it crashes -- and then switch back to using the object file (after making your changes, use Options>>Create Object File to create a new toolbox.obj, and then termporarily swap out the one in the toolslib\toolbox\msvc folder)

 

By the way, to switch back and forth between a debug and a release build of toolbox, you don't have to go through all those steps that you went through. All you had to do is to follow literally what I wrote ("...add toolbox.c to your project"). That should have been sufficient...Smiley Wink

0 Kudos
Message 10 of 20
(4,786 Views)