LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RunPopupMenu crash in CVI 9.0

Gents,

 

I recently upgrade my LabWindows to version 9.0 and I have a curious behavious when using RunPopupMenu.

 

Up to version 8.5 the following code was working fine :

 

popUpMenuBar  = NewMenuBar (0); 
popUpMenuId   = NewMenu (popUpMenuBar, "JtagCopyMenu", -1);

cutId = NewMenuItem (popUpMenuBar, popUpMenuId, "Cut", -1,0,NULL,NULL);
copyId = NewMenuItem (popUpMenuBar, popUpMenuId, "Copy", -1,0,NULL,NULL);
pasteId = NewMenuItem (popUpMenuBar, popUpMenuId, "Paste", -1,0,NULL,NULL);
    
GetRelativeMouseState (panel, 0, &x, &y, NULL, NULL, NULL);      //Get mouse coordinates

itemId = RunPopupMenu (popUpMenuBar, popUpMenuId, panel, y, x, 0, 0, 0, 0); //Display popup menu at mouse position
  
DiscardMenuBar (popUpMenuBar);

 

Since version 9.0, the menu displays correctly but I have a general protection fault as soon as I click on a item.

When I give a menu callback address like this :

cutId = NewMenuItem (popUpMenuBar, popUpMenuId, "Cut", -1,0,popupMenuClbk,NULL);

 

The problem disapear, event if the callback is an empty function.

 

Other observation, when I launch an executable compiled with 8.5 version on a version 9.0 run-time engine, this one also crash when I click on the same item.

 

Any idea ?

Stéphane

 

 

  

Labwindows/CVI user since version 4.0
0 Kudos
Message 1 of 7
(4,364 Views)

Hello Stéphane,

 

I tried reproducing the crash but haven't been able to, so far. It's probably the case that I need to replicate some additional aspects of your program in order to trigger it. Would you be able to attach a small program that we can use to reproduce the problem?

 

Thanks,

Luis

Message Edited by LuisG on 12-09-2008 10:59 AM
0 Kudos
Message 2 of 7
(4,347 Views)

Luis,

 

I have also tried on my side to isolate the problem in a small project without success.

I think also that there is some kind of interaction with another section of my application. But this one is quite big (more than 20000 lines of code) and uses some SDK functionalities to intercept windows messages like WM_DEVICECHANGE. So I am now trying to disable one by one all the modules to find which one is guilty.

 

Anyway, the problem wasn't happening in 8.5 version (on the same PC, same OS ...), so something has changed in the run-time engine concerning the callback management during RunPopupMenu execution.

 

thanks for your help,

Stephane  

Labwindows/CVI user since version 4.0
0 Kudos
Message 3 of 7
(4,308 Views)

I got it !

 

The problem occur when using InstallMainCallback function to answer to EVENT_END_TASK message.

 

I attach a sample project that makes the problem occur.

Just right click on the knob or on the "generate" button to display the popup menu and click the "crash now !" item to crash the application.

 

regards,

Stephane

Labwindows/CVI user since version 4.0
Message 4 of 7
(4,301 Views)

Hello Stephane,

 

Thanks for the simple example, I was able to recreate the behavior you described.  This has been reported with ID 136678 for further investigation.  Thanks again for the feedback.

 

NickB

National Instruments 

Message 5 of 7
(4,283 Views)

Hello,

 I have exactly the same problem. It there a way to bypass this problem or must I go back to CVI 8.5?

 

thanks for your help,
SamV

0 Kudos
Message 6 of 7
(4,142 Views)

HI SamV,

 

You can bypass the problem by creating a dummy callback function like this one :

 

void CVICALLBACK DummyPopupMenuClbk (int menuBarHandle, int menuItemID, void *callbackData, int panelHandle)
{
}

 

and then specify to each "NewMenuItem" routine that you want to use that callback like this :  

 

itemId = NewMenuItem (popUpMenuBar, popUpMenuId, "Cut", -1,0,DummyPopupMenuClbk,NULL);

 

Hope this will help you.

Stephane

Labwindows/CVI user since version 4.0
Message 7 of 7
(4,138 Views)