Fix crash with Vietnamese input method on macOS

This commit is contained in:
Václav Slavík
2017-03-31 19:08:57 +02:00
parent 15ae00d7a2
commit d1c5f107a1

View File

@@ -724,12 +724,13 @@ bool wxNSTextViewControl::CanFocus() const
return true; return true;
} }
void wxNSTextViewControl::insertText(NSString* text, WXWidget slf, void *_cmd) void wxNSTextViewControl::insertText(NSString* str, WXWidget slf, void *_cmd)
{ {
NSString *text = [str isKindOfClass:[NSAttributedString class]] ? [str string] : str;
if ( m_lastKeyDownEvent ==NULL || !DoHandleCharEvent(m_lastKeyDownEvent, text) ) if ( m_lastKeyDownEvent ==NULL || !DoHandleCharEvent(m_lastKeyDownEvent, text) )
{ {
wxOSX_TextEventHandlerPtr superimpl = (wxOSX_TextEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd]; wxOSX_TextEventHandlerPtr superimpl = (wxOSX_TextEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
superimpl(slf, (SEL)_cmd, text); superimpl(slf, (SEL)_cmd, str);
} }
} }