mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-15 01:46:34 +01:00
fix WavesDropdown when used with radio menu items
::clear_items() would render the RadioMenuItem::group() invalid, thus causing crashes if the dropdown is populated, cleared and repopulated. So redesign things to avoid a member group.
This commit is contained in:
parent
5bd1fad1be
commit
f0f8b239ef
2 changed files with 8 additions and 2 deletions
|
|
@ -84,7 +84,14 @@ WavesDropdown::add_radio_menu_item (const std::string& item, void* cookie)
|
|||
{
|
||||
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||
|
||||
items.push_back (Gtk::Menu_Helpers::RadioMenuElem (_radio_menu_items_group, item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), items.size (), cookie)));
|
||||
if (items.empty()) {
|
||||
Gtk::RadioMenuItem::Group group;
|
||||
items.push_back (Gtk::Menu_Helpers::RadioMenuElem (group, item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), items.size (), cookie)));
|
||||
} else {
|
||||
Gtk::RadioMenuItem* first = dynamic_cast <Gtk::RadioMenuItem*> (&_menu.items ().front ());
|
||||
Gtk::RadioMenuItem::Group group = first->get_group();
|
||||
items.push_back (Gtk::Menu_Helpers::RadioMenuElem (group, item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), items.size (), cookie)));
|
||||
}
|
||||
|
||||
Gtk::RadioMenuItem& menuitem = *dynamic_cast <Gtk::RadioMenuItem*> (&_menu.items ().back ());
|
||||
ensure_style();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ class WavesDropdown : public WavesIconButton
|
|||
private:
|
||||
Gtk::Menu _menu;
|
||||
int _selected_item_number;
|
||||
Gtk::RadioMenuItem::Group _radio_menu_items_group;
|
||||
void _on_menu_item (int item_number, void* cookie);
|
||||
void _on_popup_menu_position (int& x, int& y, bool& push_in);
|
||||
bool _on_mouse_pressed (GdkEventButton*);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue