12-10-2017 03:25 AM
Hey,
I am using cursors and displaying annotation in a graph using the following code:
int CVICALLBACK assgraph (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
double x,y;
float ox=0,oy=0;
char aminos[20];
if (n < 50 || p == 1) break;
GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, 2, &graphTabPanelHandle);
GetGraphCursor (graphTabPanelHandle, TABPANEL_3_assgraph, 1, &x, &y);
SetCtrlVal (graphTabPanelHandle, TABPANEL_3_X, x);
SetCtrlVal (graphTabPanelHandle, TABPANEL_3_Y, y);
DeleteGraphAnnotation (graphTabPanelHandle,TABPANEL_3_assgraph, -1);
sprintf (aminos, "%c%d-%c%d",seqarray[(int)x],(int)x,seqarray[(int)y],(int)y);
if (x > n-10) ox=ox-3;
if (y > n-10) oy=oy-3;
if (x < 10) ox=ox+1;
if (y < 10) oy=oy+3;
AddGraphAnnotation(graphTabPanelHandle,TABPANEL_3_assgraph, x+ox, y+oy, aminos, 3, 3);
break;
}
return 0;
}
When I press the graph in different locations 10-12 times fast I get the following message:
FATAL RUN-TIME ERROR: "...c", line 463, col 8, thread id 0x00004670: The program has caused a 'General Protection' fault at 0x684FE961.
Strangely, the line RunUserInterface (); in int main (int argc, char *argv[]) function is highlighted - I don't understand why this function even works (is it a bug?), when I tried to put a breaking point there it did not stop.
How can I prevent this error?
Thanks!
12-11-2017 02:22 PM
I'm not to familiarized with General protection faults, but it seems like these can happen for a variety of reasons, the RunUserInterface() function is the one of issuing userCallbacks which would explain why this is happening in response to your clicks on the graph.
How "quickly" do you need to click on the graph for this error to happen?
Do you see it with any other controls?