From dbd98a107887b568faf0ef8bb930042f1941e10b Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 5 Jan 2016 21:13:39 +0100 Subject: [PATCH] Don't attempt to uncheck menu radio item in wxGTK Unchecking radio item makes no sense and wxMSW does nothing in this case, so don't do anything in wxGTK neither, in particular don't generate a spurious wxEVT_MENU. Closes #17318. --- src/gtk/menu.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 5740187933..e3f6abd366 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -684,18 +684,23 @@ void wxMenuItem::Check( bool check ) if (check == m_isChecked) return; - wxMenuItemBase::Check( check ); - switch ( GetKind() ) { - case wxITEM_CHECK: case wxITEM_RADIO: + // It doesn't make sense to uncheck a radio item. + if ( !check ) + return; + + wxFALLTHROUGH; + case wxITEM_CHECK: gtk_check_menu_item_set_active( (GtkCheckMenuItem*)m_menuItem, (gint)check ); break; default: wxFAIL_MSG( wxT("can't check this item") ); } + + wxMenuItemBase::Check( check ); } void wxMenuItem::Enable( bool enable )