Quit when failed to create quartz event tap

This commit is contained in:
Xinyu Hou 2017-12-13 09:42:41 -05:00
parent d5872caa7e
commit 4dc9f893c3
1 changed files with 2 additions and 0 deletions

View File

@ -203,11 +203,13 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
if (!m_eventTapPort) {
LOG((CLOG_ERR "failed to create quartz event tap"));
m_events->addEvent(Event(Event::kQuit));
}
m_eventTapRLSR = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, m_eventTapPort, 0);
if (!m_eventTapRLSR) {
LOG((CLOG_ERR "failed to create a CFRunLoopSourceRef for the quartz event tap"));
m_events->addEvent(Event(Event::kQuit));
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode);