Bug 41447 - [GTK] Extra nullcheck needed at SelectionControllerGtk.cpp
Summary: [GTK] Extra nullcheck needed at SelectionControllerGtk.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-01 00:21 PDT by Mario Sanchez Prada
Modified: 2010-07-01 03:50 PDT (History)
1 user (show)

See Also:


Attachments
Patch proposal (3.12 KB, patch)
2010-07-01 00:46 PDT, Mario Sanchez Prada
xan.lopez: review-
Details | Formatted Diff | Diff
Patch proposal (2.31 KB, patch)
2010-07-01 01:10 PDT, Mario Sanchez Prada
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Sanchez Prada 2010-07-01 00:21:19 PDT
In SelectionController::notifyAccessibilityForSelectionChange(), inside SelectionControllerGtk.cpp, we currently have this:

   [...]
   AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->getOrCreate(focusedNode);
   int offset;

   // Always report the events w.r.t. the non-linked unignored parent. (i.e. ignoreLinks == true)
   AccessibilityObject* object = objectAndOffsetUnignored(accessibilityObject, offset, true);
   [...]

The problem with this is that, as getOrCreate() could return 0 under some dark circunstances, we're risking here calling to objectAndOffsetUnignored() with null as first parameter, which will crash for sure as that function won't check that (that's a common assumption in AccessibilityObjectWrapperAtk.cpp).

Hence, an extra null check is needed. Attaching one-liner patch soon...
Comment 1 Mario Sanchez Prada 2010-07-01 00:46:21 PDT
Created attachment 60209 [details]
Patch proposal

Attached patch for this issue.
Comment 2 Xan Lopez 2010-07-01 01:06:49 PDT
Comment on attachment 60209 [details]
Patch proposal

I think doing:

if (!accessibilityObject)
    return;

is much better.

Also, we should look into why a NULL object is being created in the first place...
Comment 3 Mario Sanchez Prada 2010-07-01 01:10:20 PDT
Created attachment 60213 [details]
Patch proposal

(In reply to comment #2)
> (From update of attachment 60209 [details])
> I think doing:
> 
> if (!accessibilityObject)
>     return;
> 
> is much better.

Done.

> Also, we should look into why a NULL object is being created in the first place...

Agree, and I have the feeling is related to the rendering object not being created by that time, although that would be quite weir and would be indeed another bug for sure... In any case I think this null check doesn't hurt either.
Comment 4 WebKit Commit Bot 2010-07-01 03:50:47 PDT
Comment on attachment 60213 [details]
Patch proposal

Clearing flags on attachment: 60213

Committed r62248: <http://trac.webkit.org/changeset/62248>
Comment 5 WebKit Commit Bot 2010-07-01 03:50:51 PDT
All reviewed patches have been landed.  Closing bug.