‎12-10-2019 01:21 PM
CVI 2019.
I have a couple pretty large apps that have suddenly started acting odd under 2019 in debug on Win10. When I quit the app EVENT_DISCARD is issued to every Callback function. Not just once, but infinitely. I always have to click the red stop button a couple extra times to get the app to actually quit. I put a case EVENT_DISCARD: in one of the callbacks, with a breakpoint, so I could see this point reached over and over. At some point a stack overflows or something, because the app goes belly-up quitting at some unknown location.
This does not seem to happen in Windows 7.
Anyone ever see this? Is there some setting in the IDE I'm missing to prevent this?
‎12-11-2019 02:36 AM
I have just installed 2019, so I have not been working yet with my many old programs. Do you do anything in your EVENT_DISCARD cases ? If not, why do you have a case ? And what if you return 1 to swallow the event ?
‎12-11-2019 08:49 AM
After a little investigation of why the app never actually quite, I found the EVENT_DISCARD thing. Added a case to one callback, just to trap it and see that every callback was issued the event thousands of times, until something just failed. I will try the return 1; but the library .h says the event is not swallowable.
‎12-11-2019 09:18 AM
return 1; does nothing. EVENT_DISCARD continues to be issued thousands of times.
‎12-18-2019 08:31 AM
I still need help with this.
Has anybody seen behavior like this?
‎12-19-2019 07:24 AM - edited ‎12-19-2019 07:24 AM
Where do you call QuitUserInterface() ?
‎12-19-2019 08:03 AM
As I mentioned in the first post, this does not happen in Win7, only Win10.
I think this is very standard.
At the end of Main:
RunUserInterface ();
QuitUserInterface();
DiscardPanel (panelHandle);
return 0;
}
At the end of QuitCallback:
Sleep(500);
QuitUserInterface (0);
break;
}
return 0;
}
Perhaps it is routine to send EVENT_DISCARD to every callback during the execution of DiscardPanel(), but it never stops. It just cycles through all callbacks forever, sending EVENT_DISCARD.
‎12-19-2019 08:54 AM
You QuitUserInterface should be in the callback of your top panel(s) in reply to EVENT_CLOSE
‎12-19-2019 09:27 AM
I have used exactly the method specified in the RunUserInterface function panel, shown below. And as outlined in the code fragments posted previously.
int main (int argc, char *argv[])
{
int status;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "sample.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
status = RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
/* additional callback functions here */
int CVICALLBACK QuitCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}