Fix crash on setting the accelerator table in wxQt
Check whether m_qtShortcuts is non-null before dereferencing it. Closes https://github.com/wxWidgets/wxWidgets/pull/1040
This commit is contained in:
committed by
Vadim Zeitlin
parent
5e089badc0
commit
94a58121f7
@@ -936,13 +936,17 @@ void wxWindowQt::SetAcceleratorTable( const wxAcceleratorTable& accel )
|
||||
{
|
||||
wxWindowBase::SetAcceleratorTable( accel );
|
||||
|
||||
// Disable previously set accelerators
|
||||
while ( !m_qtShortcuts->isEmpty() )
|
||||
delete m_qtShortcuts->takeFirst();
|
||||
if ( m_qtShortcuts )
|
||||
{
|
||||
// Disable previously set accelerators
|
||||
while ( !m_qtShortcuts->isEmpty() )
|
||||
delete m_qtShortcuts->takeFirst();
|
||||
|
||||
// Create new shortcuts (use GetHandle() so all events inside
|
||||
// the window are handled, not only in the container subwindow)
|
||||
delete m_qtShortcuts;
|
||||
}
|
||||
|
||||
// Create new shortcuts (use GetHandle() so all events inside
|
||||
// the window are handled, not only in the container subwindow)
|
||||
delete m_qtShortcuts;
|
||||
m_qtShortcuts = accel.ConvertShortcutTable( GetHandle() );
|
||||
|
||||
// Connect shortcuts to window
|
||||
|
Reference in New Issue
Block a user