[ wxwindows-Bugs-800681 ] RadioGroup Menus assert on add after a delete

SourceForge.net noreply at sourceforge.net
Fri Jun 1 10:58:20 PDT 2007


Bugs item #800681, was opened at 2003-09-04 19:59
Message generated for change (Comment added) made by roebling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=800681&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxMac specific
Group: Platform specific
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Shawn Pourchot (shawnp)
Assigned to: Nobody/Anonymous (nobody)
Summary: RadioGroup Menus assert on add after a delete

Initial Comment:
You will get an assert on this scenerio:

1. Create a menu radiogroup of 3 items
2. Delete all 3 items
3. Add a new radio group menu item in the same place.
4. This will cause an assert because 
wxMenu::m_startRadioGroup has a value of 0 which 
causes it to look for non existent menu item.

Looks like when deleting radio groups it should update 
the m_startRadioGroup back to -1 so it will generate a 
new group.

It should also handle the case if you delete the start 
menu item and set the next item in the group to be the 
start.  The case if deleting menu items from the middle 
of the group also needs to be handled.

----------------------------------------------------------------------

>Comment By: Robert Roebling (roebling)
Date: 2007-06-01 17:58

Message:
Logged In: YES 
user_id=77100
Originator: NO

Can someone provide a patch, please.

----------------------------------------------------------------------

Comment By: Tibo (blacktibo)
Date: 2007-06-01 12:46

Message:
Logged In: YES 
user_id=1805937
Originator: NO

I have seen the same problem on WxWidgets 2.8.3. 

As shawnp said, m_startRadioGroup is not reset to -1 when last group item
is destroyed.
The better workaroud I found (without adding a pseudo-element and deleting
it immediately) is to change the 'EndRadioGroup' visibility from private to
public.

Once this method visible, just call it when you destroy the last item, to
close the group (at the end of the 2nd step in the scenario).

To do it fine, and completely, here are the files to modify :
 - include\wx\mac\carbon\menu.h
 - include\wx\mac\classic\menu.h
 - include\wx\msw\menu.h
 - include\wx\os2\menu.h
 - include\wx\palmos\menu.h
 - include\wx\univ\menu.h


----------------------------------------------------------------------

Comment By: Thomas Uram (turam)
Date: 2006-08-01 14:43

Message:
Logged In: YES 
user_id=901223

I have seen this same problem on Windows (version 2.6.3.2)
and Linux (version 2.6.1.2ubuntu2).  I have worked around it
for now:

- delete all items
- add a string item to the menu and remove it
- add the radio items back in



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=800681&group_id=9863




More information about the wx-dev mailing list