Bug 42350 - Socket's implementation of ref_state_set to return empty sets instead of NULL
Summary: Socket's implementation of ref_state_set to return empty sets instead of NULL
Status: RESOLVED FIXED
Alias: None
Product: at-spi2
Classification: Unclassified
Component: atk (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Rob Taylor
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-28 11:25 UTC by Mario Sanchez Prada
Modified: 2011-10-28 12:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch proposal (2.01 KB, patch)
2011-10-28 11:33 UTC, Mario Sanchez Prada
Details | Splinter Review

Description Mario Sanchez Prada 2011-10-28 11:25:02 UTC
In accessible-cache.c, in add_pending_items(), it's assumed that the call to atk_object_ref_state_set() is always gonna return a valid state set, since right after that there's a call to atk_state_set_contains_state() without even checking if 'set' is NULL.

However, if I check the implementation of socket's ref_state_set function (in bridge.c), it can return NULL in a variety of situations: plug still not embedded, no valid path, no reply got from DBus...

Checking the default implementation in AtkObject's ref_state_set function, I saw that, instead of returning NULL in those invalid cases, it just return an empty state set, which I think it's a better approach.

So I think we should change the only redefinition of ref_state_set in at-spi2-atk, which is socket_ref_state_set() in bridge.c, to return an empty state set instead of NULL in the cases that not a valid state set could be returned.

Another option would be to add a null-check in add_pending_items to ensure that the set is a valid one after calling to atk_object_ref_state_set, but that could hide some real bugs so I don't think that's a so good approach.
Comment 1 Mario Sanchez Prada 2011-10-28 11:33:08 UTC
Created attachment 52864 [details] [review]
Patch proposal
Comment 2 Mike Gorse 2011-10-28 12:09:36 UTC
Looks fine. Go ahead and commit (and update the gnome-3-2 branch too if you'd like). Thanks for the patch.
Fyi, we've been using BGO for AT-SPI2 bugs lately (we decided a while ago that it made sense to add at-spi2 components there, since the code is on git.gnome.org now and people were filing bugs on BGO anyway...)
Comment 3 Mario Sanchez Prada 2011-10-28 12:26:34 UTC
(In reply to comment #2)
> Looks fine. Go ahead and commit (and update the gnome-3-2 branch too if you'd
> like). Thanks for the patch.

Done (updated gnome-3-2 too)

> Fyi, we've been using BGO for AT-SPI2 bugs lately (we decided a while ago that
> it made sense to add at-spi2 components there, since the code is on
> git.gnome.org now and people were filing bugs on BGO anyway...)

Sure, sorry about that. Next bugs will be filed in bgo, with at-spi2-atk as component.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.