Add validity check before doing accelerator key creation
This commit is contained in:
@@ -665,7 +665,7 @@ void wxMenuItem::SetGtkLabel()
|
|||||||
guint accel_key;
|
guint accel_key;
|
||||||
GdkModifierType accel_mods;
|
GdkModifierType accel_mods;
|
||||||
wxGetGtkAccel(this, &accel_key, &accel_mods);
|
wxGetGtkAccel(this, &accel_key, &accel_mods);
|
||||||
if (accel_key)
|
if ( accel_key && gtk_accelerator_valid( accel_key, accel_mods ) )
|
||||||
{
|
{
|
||||||
gtk_widget_add_accelerator(
|
gtk_widget_add_accelerator(
|
||||||
m_menuItem, "activate", GetRootParentMenu(m_parentMenu)->m_accel,
|
m_menuItem, "activate", GetRootParentMenu(m_parentMenu)->m_accel,
|
||||||
@@ -673,7 +673,7 @@ void wxMenuItem::SetGtkLabel()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Remove the accelerator since it couldn't be made
|
// Remove the accelerator since it couldn't be made or is invalid
|
||||||
m_text = m_text.BeforeFirst( wxT( '\t' ) );
|
m_text = m_text.BeforeFirst( wxT( '\t' ) );
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
Reference in New Issue
Block a user