Hi all,
I have a (large complex) CVI linux program that sometimes lockup while opening large ring selectors (large being defined by a hundred or so items, more than the vertical screen can handle but not insanely so). It fairly often locks up at this stage and needs to be killed.
Reading about this issue, I've seen that it may happen if InstallPopup is called in the same thread. Is it still the case as the message is from 2006 ? There are many conditions in my prog when InstallPopup (or 2nd instances of RunUserInterface) are called by timers or external conditions, but I don't think it is the case here.
I wrote the following test case, but I doesn't exhibit the problem. Anything else I can check ? Any way to know if a ring is currently expanded before calling InstallPopup ? And NO, I do NOT want to multithread my program, it's already nightmarish enough !
#include <ansi_c.h> #include <userint.h> #include <cvirte.h> static int Led=0; int CVICALLBACK cb_Ring(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int Val; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, control, &Val); if (Val==0) // Select 0 to quit QuitUserInterface (0); break; } return 0; } int CVICALLBACK cbt_Timer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { static int Val=0; switch (event) { case EVENT_TIMER_TICK: SetCtrlVal(panel, Led, Val++&1); if (Val%10==0) ConfirmPopup ("Crash?", "Do you think this will lock up?"); break; } return 0; } static void InsertLabels(int Panel, int Ctrl, int Nb) { char Label[10]; for (int i=0; i<Nb; i++) { sprintf(Label, "-%03d-", i); InsertListItem (Panel, Ctrl, -1, Label, i); } } int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) return -1; int Pnl = NewPanel(0, "Test Ring", 20, 20, 100, 100); int Tmr = NewCtrl (Pnl, CTRL_TIMER, "Timer", 50, 50); SetCtrlAttribute (Pnl, Tmr, ATTR_CALLBACK_FUNCTION_POINTER, cbt_Timer); Led = NewCtrl (Pnl, CTRL_ROUND_LED_LS, "Led", 50, 2); int Ring = NewCtrl (Pnl, CTRL_RING_LS, "Ring", 20, 2); SetCtrlAttribute (Pnl, Ring, ATTR_CALLBACK_FUNCTION_POINTER, cb_Ring); InsertLabels(Pnl, Ring, 200); DisplayPanel (Pnl); return RunUserInterface (); }