LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

General Protection fault in CVI 7.0

Hi,

When calling DisplayPanel() in CVI 7.0 my application (originally written in CVI 6.0) generates a General Protection fault when the panel contains a graph control with Data Mode:Retain and Copy Original Plot Data NOT set.

Is this a known bug?

Regards

Jamie Fraser
0 Kudos
Message 1 of 15
(4,884 Views)
Do you have a small example of this that I can try out on my end?
I havent really come across anything like this before. Also try adding and replacing the graph control on the UIR.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 15
(4,882 Views)
Bilal,

The thread entitled "Graph differ in CVI 6.0 and 7.0" ultimately answered by Luis Gomes seems to relate to this same issue. I did as suggested by Luis in that thread and switched auto-scaling off on the top x-axis and that stopped the problem, i.e. DisplayPanel() returned successfully. However, when I tried to zoom the graph I got the same General Protection fault returned from RunUserInterface(), so it seems to be a problem with attempted graph redraws when the graph data is not "copied", but is only "retained". Is this enough for you to go on as the app is reasonably large and I would need to send you more than the allowed three files.

Regards

Jamie Fraser
0 Kudos
Message 3 of 15
(4,884 Views)
PS. I only tried the zoom as a quick test, I normally have zoom disabled unless the original data is copied.
0 Kudos
Message 4 of 15
(4,882 Views)
So i bascailly took the graph shipping example( ..\samples\userint\graphs.cws ). Made the control mode "Hot", uncheck "Copy original Plot data", enabled zooming, selected data mode as retain, made the top axis autoscale. I tried zooming on the plotted data as well, but didnt see the problem. Try to see if you can use the same example to reproduce the problem. If not, I can try to have a look at your project.

Bilal
Bilal Durrani
NI
0 Kudos
Message 5 of 15
(4,882 Views)
Bilal,

I couldn't get the shipping sample to give the same error either. I have attached my project files. If you compile the files (ignore the build warnings, Luis Gomes has established these to be due to a compiler error in CVI 7.0) and select Analysis>Spectrum Analyser you should get the General Protection fault.

If you go into the UIR and change the top x-axis on the offending graph to non-Auto scale the fault does not occur. You can also get the same result by enabling zooming and attempting a zoom.

Regards

Jamie Fraser
Download All
0 Kudos
Message 6 of 15
(4,885 Views)
So i think what might be happening is that when the "Copy data" option for the graph is not set, the graph still looks to the original buffer for the data. So when zooming or moving the graph around, it still expects the data to be there in the original buffer. So I commented out the free(spectrum) on line 1390, and now that zooming error is no more, even with the option to auto scale the top axis.

Try delaying freeing the memory when the program exist. I'll investigate this further and make sure whether this should be a corrective action request.

Let me know what you find.

Bilal
Bilal Durrani
NI
0 Kudos
Message 7 of 15
(4,885 Views)
Hi Bilal,

I have confirmed your findings. It would seem that when attempting the redraw, CVI accesses a pointer to my original plot data which I have clearly freed in the meantime.

This is where I get confused between the exact difference between Data Mode:Retain and Copy Original Plot Data. Reading the help for the latter clearly states that "erroneous results might occur if you change or deallocate the data". However, the help for Data Mode suggests that, if set to Retain, CVI keeps a copy of the plot data in memory anyway.

So, when does CVI reference my own plot data buffer, and when does it reference its own copy?

At the very least I would suggest there has been a change between CVI 6.0 and CVI 7
.0. I will be interested to know if you decide that a corrective action request should be raised.

With thanks for your help.

Jamie Fraser
0 Kudos
Message 8 of 15
(4,885 Views)
Bilal,

I think I may have been confused by the terminology. I think I understand now that Copy Original Plot Data makes a copy of the array that I want to plot, and that copied data is used instead of the original data array when the data needs to be scaled for plotting. Data Mode:Retain causes the data *after* scaling to be copied and retained so the graph can be redrawn by operations that do not require the original data to be rescaled to the axes ranges.

Therefore, it seems quite reasonable for a General Protection fault to be generated if a scaling operation is attempted when the original data area has been released. What seems to be wrong in CVI 7.0 is that a scaling operation is being perfor
med unexpectedly. This seems to be exactly what was being referred to in the thread "Graph differ in CVI 6.0 and 7.0", but the end result in my case is slightly different.

I would suggest, then, that a new corrective action request is not needed, as the one raised already should fix the same problem.

Do you agree?

Regards

Jamie Fraser
0 Kudos
Message 9 of 15
(4,885 Views)
aye, that sounds right.

just wanted to make one thing clear, though. I wasnt able to reproduce the original problem of the GPF in DisplayPanel().
The problem that we saw here had to do with the buffer getting freed with the Copy data option not set, which is something that would have happened in CVI 6 as well. So I guess it would'nt really be a CAR since the documentatio did mention unexpected behavior
It's not a problem that was introduced in 7 and if this was the problem, it should'nt have happened in DisplayPanel().

So it would seem that this was a different issue than what was mentioned in the "Graph differ in CVI 6.0 and 7.0" thread.

Let me know if I missed a step with the Disp
layPanel() GPF, because the only place I managed to see the problem was when zooming with the buffer not copied and de-allocated.

Thanks

Bilal
Bilal Durrani
NI
0 Kudos
Message 10 of 15
(4,885 Views)