Bug 18218 - [Gtk] segfault when clicking on a disabled button
Summary: [Gtk] segfault when clicking on a disabled button
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
Keywords: Gtk
Depends on:
Reported: 2008-03-30 09:16 PDT by Zoltan Dome
Modified: 2008-04-18 04:16 PDT (History)
4 users (show)

See Also:

test file for bug (32 bytes, text/html)
2008-03-30 09:17 PDT, Zoltan Dome
no flags Details
Add a null check before using the focused frame (1.27 KB, patch)
2008-04-13 19:30 PDT, Jan Alonzo
alp: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Dome 2008-03-30 09:16:36 PDT
Webkit segfaults when clicking on a disabled button.

This only happens when the disabled button is on the first page loaded by the engine AND is the first thing clicked on.

So, for example, if I start GtkLauncher with a test-file and click the button, it crashes, but it doesn't crash if I click somewhere else on the page first.
Comment 1 Zoltan Dome 2008-03-30 09:17:59 PDT
Created attachment 20212 [details]
test file for bug
Comment 2 Julien Chaffraix 2008-04-09 08:56:08 PDT
Confirmed on ToT.

The cause is in webkit_web_view_button_release_event (webkitwebview.cpp) when focusFrame is null. There is no null check so we call one of focusFrame's methods which results in a crash.
Comment 3 Jan Alonzo 2008-04-13 19:30:34 PDT
Created attachment 20511 [details]
Add a null check before using the focused frame

The patch checks for a null focusedFrame before calling the event handler. Thanks jchaffraix for the hint.
Comment 4 Kalle Vahlman 2008-04-17 04:02:12 PDT
Apparently this bug is also an issue with having a "mousedown" event handler that calls event.preventDefault().

I tested Jan's patch, and it fixes things for both cases.
Comment 5 Alp Toker 2008-04-18 04:01:31 PDT
Comment on attachment 20511 [details]
Add a null check before using the focused frame


The correct fix is to use the main frame for mouse events since it has the logic to bubble the event to the correct owner.

I'll take care of this one.
Comment 6 Alp Toker 2008-04-18 04:16:15 PDT
(Different) fix landed in r32203.

Thanks for tracking this issue Jan!