Closed Bug 784783 Opened 9 years ago Closed 9 years ago
Inconsistency Exception: Invalid message sent to event "NSEvent
2012-08-22 11:55:11.641 firefox[11805:110b] *** Assertion failure in -[NSEvent characters], /SourceCache/AppKit/AppKit-1138.47/AppKit.subproj/NSEvent.m:1695 2012-08-22 11:55:11.642 firefox[11805:110b] Mozilla has caught an Obj-C exception [NSInternalInconsistencyException: Invalid message sent to event "NSEvent: type=FlagsChanged loc=(0,821) time=864407.9 flags=0x100 win=0x115003290 winNum=13629 ctxt=0x0 keyCode=0"] 2012-08-22 11:55:11.645 firefox[11805:110b] Generating stack trace for Obj-C exception... 2012-08-22 11:55:12.050 firefox[11805:110b] Stack trace: Looking up symbols in process 11805 named: firefox 140735547596602 140735507983710 140735547596170 140735564347167 140735411192373 4343907671 4343924259 4343929866 4343926574 4343706116 140735410530220 4343625685 140735410107940 4343548946 140735409676486 4343558108 4340068999 4313364766 4313366591 4313367647 4294975164 4294973317 4294971620 I get this exception on nightly when switching to the application. I get it often, but not all the time. Here is the stack trace: #0 0x00007fff89f5ed45 in objc_exception_throw () #1 0x00007fff8c525d8a in +[NSException raise:format:arguments:] () #2 0x00007fff8d51f71f in -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] () #3 0x00007fff84310235 in -[NSEvent characters] () #4 0x0000000102eac557 in mozilla::widget::TISInputSourceWrapper::InitKeyEvent (this=0x7fff5fbfde10, aNativeKeyEvent=0x114e3be80, aKeyEvent=@0x7fff5fbfdef0, aInsertString=0x0) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/TextInputHandler.mm:728 #5 0x0000000102eb0623 in mozilla::widget::TextInputHandlerBase::InitKeyEvent (this=0x1152311f0, aNativeKeyEvent=0x114e3be80, aKeyEvent=@0x7fff5fbfdef0, aInsertString=0x0) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/TextInputHandler.mm:3816 #6 0x0000000102eb1c0a in mozilla::widget::TextInputHandler::DispatchKeyEventForFlagsChanged (this=0x1152311f0, aNativeEvent=0x114e3be80, aDispatchKeyDown=false) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/TextInputHandler.mm:1546 #7 0x0000000102eb0f2e in mozilla::widget::TextInputHandler::HandleFlagsChanged (this=0x1152311f0, aNativeEvent=0x114e3be80) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/TextInputHandler.mm:1497 #8 0x0000000102e7b204 in -[ChildView flagsChanged:] (self=0x1150b3e00, _cmd=0x7fff84af2892, theEvent=0x114e3be80) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/nsChildView.mm:4151 #9 0x00007fff8426e7ac in -[NSWindow sendEvent:] () #10 0x0000000102e677d5 in -[ToolbarWindow sendEvent:] (self=0x115003290, _cmd=0x7fff84b1cd42, anEvent=0x114e3be80) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/nsCocoaWindow.mm:2711 #11 0x00007fff84207624 in -[NSApplication sendEvent:] () #12 0x0000000102e54c12 in -[GeckoNSApplication sendEvent:] (self=0x10030c230, _cmd=0x7fff84b1cd42, anEvent=0x114e3be80) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/nsAppShell.mm:157 #13 0x00007fff8419e0c6 in -[NSApplication run] () #14 0x0000000102e56fdc in nsAppShell::Run (this=0x10a8558e0) at /Users/hub/source/mozilla/mozilla-central/widget/cocoa/nsAppShell.mm:756 #15 0x0000000102b03287 in nsAppStartup::Run (this=0x10a09ba10) at /Users/hub/source/mozilla/mozilla-central/toolkit/components/startup/nsAppStartup.cpp:273 #16 0x000000010118b91e in XREMain::XRE_mainRun (this=0x7fff5fbfee28) at /Users/hub/source/mozilla/mozilla-central/toolkit/xre/nsAppRunner.cpp:3800 #17 0x000000010118c03f in XREMain::XRE_main (this=0x7fff5fbfee28, argc=6, argv=0x7fff5fbffa18, aAppData=0x1000081c0) at /Users/hub/source/mozilla/mozilla-central/toolkit/xre/nsAppRunner.cpp:3877 #18 0x000000010118c45f in XRE_main (argc=6, argv=0x7fff5fbffa18, aAppData=0x1000081c0, aFlags=0) at /Users/hub/source/mozilla/mozilla-central/toolkit/xre/nsAppRunner.cpp:3953 #19 0x0000000100001ebc in do_main (argc=6, argv=0x7fff5fbffa18) at /Users/hub/source/mozilla/mozilla-central/browser/app/nsBrowserApp.cpp:174 #20 0x0000000100001785 in main (argc=6, argv=0x7fff5fbffa18) at /Users/hub/source/mozilla/mozilla-central/browser/app/nsBrowserApp.cpp:279
> Invalid message sent to event "NSEvent: type=FlagsChanged > -[NSEvent characters] Sounds like 'characters' is being sent to an event whose type is NSFlagsChanged. This message is only valid for an NSKeyDown or NSKeyUp event. It happens here: http://hg.mozilla.org/mozilla-central/annotate/102dc2118737/widget/cocoa/TextInputHandler.mm#l728 Masayuki? :-)
Hmm, why the key which comes with NSFlagsChanged event is decided as isPrintableKey? I think that we should research what key causes it. I guess there is another bug such as that unnecessary keypress event is fired with modifier key.
This patch just prevents the exception. The root cause is, the native event's keyCode is wrong value. The keyCode is always 0 (0 is 'A' key's keycode) in such situation. So, we're dispatching 'A' keyup event at that time. But it's not regression. Let's fix it later.
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Attachment #656776 - Flags: review?(smichaud)
Attachment #656776 - Flags: review?(smichaud) → review+
And just so nobody makes a mistake landing on Aurora if you're not around when it needs to land there, followed up with https://hg.mozilla.org/integration/mozilla-inbound/rev/a962ec74a526 because that version of the patch had a stray extra ) in it.
I attached old patch which isn't fixed the bustage caused by redundant ")".
Attachment #656776 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment on attachment 657143 [details] [diff] [review] Patch [Approval Request Comment] Bug caused by (feature/regressing bug #): Bug 775414 User impact if declined: Users would meet the exception and the key handling would be aborted. Testing completed (on m-c, etc.): on m-c, we have no regression reports for this for this two weeks. Risk to taking this patch (and alternatives if risky): almost nothing String or UUID changes made by this patch: no
Attachment #657143 - Flags: approval-mozilla-aurora?
Comment on attachment 657143 [details] [diff] [review] Patch [Triage Comment] Given the low risk profile of this fix, it's better to be safe than sorry and fix this exception. Approving for Aurora 17.
Attachment #657143 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Hub, can you check if you still see this with the latest Firefox 17 Beta?
For what it's worth I regularly see the warning message (indicating that we avoided the originally reported exception) in Thunderbird trunk; I was seeing the exception before this fix.
You need to log in before you can comment on or make changes to this bug.