RESOLVED FIXED 51569
[GTK] EditorClient::generateEditorCommands queues up "null string" commands
https://bugs.webkit.org/show_bug.cgi?id=51569
Summary [GTK] EditorClient::generateEditorCommands queues up "null string" commands
Darin Adler
Reported 2010-12-23 15:50:44 PST
After <http://trac.webkit.org/changeset/74580>, we saw assertion failures on GTK. The cause seems to be EditorClient::generateEditorCommands calling m_pendingEditorCommands.append with a null pointer, and then later turning that into a command name string. Best fix is probably to check for null before appending to the pending commands vector.
Attachments
Patch for this issue (3.03 KB, patch)
2010-12-26 07:25 PST, Martin Robinson
no flags
Simplified version of the previous patch (2.90 KB, patch)
2010-12-27 13:53 PST, Martin Robinson
no flags
Martin Robinson
Comment 1 2010-12-26 07:25:56 PST
Created attachment 77454 [details] Patch for this issue
Eric Seidel (no email)
Comment 2 2010-12-26 13:29:40 PST
How do we test this?
Ryosuke Niwa
Comment 3 2010-12-26 13:41:59 PST
(In reply to comment #2) > How do we test this? Does eventSender use this code path?
Martin Robinson
Comment 4 2010-12-26 14:29:57 PST
(In reply to comment #2) > How do we test this? Recently a null command string would cause an assertion failure deeper in the editing code on many tests (> 20 crashes on the debug build before it ). In this patch, I added an assertion in the WebKitGTK+ specific code which ensures that no null editing command strings are generated. If this ever starts failing again, many tests will start hitting this assertion and show crashes on the bots. If this isn't sufficient, it will be pretty easy to create a test that verifies this. All keystrokes that don't result in an editor command were generating a null command string, which is why so many tests will start crashing.
Ryosuke Niwa
Comment 5 2010-12-26 15:32:00 PST
Comment on attachment 77454 [details] Patch for this issue View in context: https://bugs.webkit.org/attachment.cgi?id=77454&action=review > WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp:666 > + if (!mapKey) When is this condition ever true? I would have put an assertion here unless you know a condition in which map key is 0.
Martin Robinson
Comment 6 2010-12-27 13:53:13 PST
Created attachment 77518 [details] Simplified version of the previous patch
Martin Robinson
Comment 7 2010-12-27 13:56:42 PST
(In reply to comment #5) > When is this condition ever true? I would have put an assertion here unless you know a condition in which map key is 0. IIRC, some misbehaving GTK+ input methods (which are essentially separate programs) may generate key events with node keyval value (which is used for the keyCode() later on). I wasn't able to reproduce this, but I think not trusting the input method code is the right decision here.
Martin Robinson
Comment 8 2010-12-27 13:57:41 PST
(In reply to comment #6) > Created an attachment (id=77518) [details] > Simplified version of the previous patch I've attached a simplified version of the previous patch. It seems keyCode() will call charCode() automatically for keypress events, so it isn't necessary to special-case it.
Ryosuke Niwa
Comment 9 2010-12-27 14:35:56 PST
(In reply to comment #7) > (In reply to comment #5) > > When is this condition ever true? I would have put an assertion here unless you know a condition in which map key is 0. > > IIRC, some misbehaving GTK+ input methods (which are essentially separate programs) may generate key events with node keyval value (which is used for the keyCode() later on). I wasn't able to reproduce this, but I think not trusting the input method code is the right decision here. Ah, ok. Sounds good to me. (In reply to comment #8) > (In reply to comment #6) > > Created an attachment (id=77518) [details] [details] > > Simplified version of the previous patch > > I've attached a simplified version of the previous patch. It seems keyCode() will call charCode() automatically for keypress events, so it isn't necessary to special-case it. Ok. I trust you on this.
Martin Robinson
Comment 10 2010-12-27 14:48:28 PST
Comment on attachment 77518 [details] Simplified version of the previous patch Clearing flags on attachment: 77518 Committed r74697: <http://trac.webkit.org/changeset/74697>
Martin Robinson
Comment 11 2010-12-27 14:48:33 PST
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 12 2010-12-27 17:04:51 PST
http://trac.webkit.org/changeset/74697 might have broken Leopard Intel Debug (Tests)
Note You need to log in before you can comment on or make changes to this bug.