当IDA pro7.0遇到mojave多输入法时, 会crash
修复后文件链接, 同时修复了快捷键, 在非英文输入法下很多不可用的问题
https://github.com/fjh658/IDA7.0_SP
IDA has almost crashed!
现象:
多输入法, 在英文状态可以正常启动, 在非英文状态会crash
7.0使用的是Qt 5.6的环境
crash堆栈:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00003eadde8f1958
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [13886]
Application Specific Information:
objc_msgSend() selector name: length
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff686faa1d objc_msgSend + 29
1 org.qt-project.QtCore 0x0000000101903924 QT::QCFString::toQString(__CFString const*) + 52
2 libqcocoa.dylib 0x0000000103508f67 0x1034c0000 + 298855
原因:
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource();
CFArrayRef languages = (CFArrayRef) TISGetInputSourceProperty(source, kTISPropertyInputSourceLanguages);
if (CFArrayGetCount(languages) > 0) {
CFStringRef langRef = (CFStringRef)CFArrayGetValueAtIndex(languages, 0);
QString name = QCFString::toQString(langRef);
QLocale locale(name);
if (m_locale != locale) {
m_locale = locale;
emitLocaleChanged();
}
CFRelease(langRef);
}
langRef
野指针导致
修复:
void QCocoaInputContext::updateLocale()
{
/* https://bugreports.qt.io/browse/QTBUG-48772
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource();
CFArrayRef languages = (CFArrayRef) TISGetInputSourceProperty(source, kTISPropertyInputSourceLanguages);
if (CFArrayGetCount(languages) > 0) {
CFStringRef langRef = (CFStringRef)CFArrayGetValueAtIndex(languages, 0);
QString name = QCFString::toQString(langRef);
QLocale locale(name);
if (m_locale != locale) {
m_locale = locale;
emitLocaleChanged();
}
CFRelease(langRef);
}
*/
QString name = QString::fromNSString([[NSLocale currentLocale] objectForKey:NSLocaleIdentifier]);
QLocale locale(name);
if (m_locale != locale) {
m_locale = locale;
emitLocaleChanged();
}
}
重新编译下Qt 5.6即可.