Closed Bug 307426 Opened 19 years ago Closed 19 years ago

ensureSelectedElementIsVisible does not handle the case of no selected element

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.8beta5

People

(Reporter: readams, Assigned: readams)

Details

(Keywords: fixed1.8)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.10) Gecko/20050825 Firefox/1.0.6 (Ubuntu package 1.0.6)
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.10) Gecko/20050825 Firefox/1.0.6 (Ubuntu package 1.0.6)

there are situations in which the code calls ensureSelectedElementIsVisible when
no such element exists (such as from _refreshSelection) but this function does
not handle this case.

Trivial patch to be attached to simply make this function check before trying to
select a null list item.

Reproducible: Always
Are you sure the scrollbox doesn't already take that into consideration?
Quite certain, since with current branch builds, my xulrunner app sees lots
XPCOM bad pointer complaints stemming from this.  It may make sense to fix it in
scrollbox rather than the XBL though; not sure of the desired semantics here.

In my experience, most XPCOM object hate it when you pass null to them :-)
Attachment #195190 - Flags: first-review+
do we need a toolkit peer review?
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
ping?
Flags: blocking1.9a1?
Flags: blocking1.8b5?
Attachment #195190 - Flags: second-review+
Flags: blocking1.8b5? → blocking1.8b5+
Assignee: nobody → readams
Status: ASSIGNED → NEW
Trunk:
mozilla/toolkit/content/widgets/richlistbox.xml; new revision: 1.23;
Status: NEW → RESOLVED
Closed: 19 years ago
OS: Linux → All
Hardware: PC → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta5
Whiteboard: [needs approval]
Attachment #195190 - Flags: approval1.8b5?
Comment on attachment 195190 [details] [diff] [review]
Add a check for a selected item in ensureSelectedItemIsVisible

Per bug meeting - approved for 1.8b5.
Attachment #195190 - Flags: approval1.8b5? → approval1.8b5+
Flags: blocking1.9a1?
Whiteboard: [needs approval]
1.8 Branch:
Checking in richlistbox.xml;
/cvsroot/mozilla/toolkit/content/widgets/richlistbox.xml,v  <--  richlistbox.xml
new revision: 1.13.2.7; previous revision: 1.13.2.6
done
Status: RESOLVED → VERIFIED
Keywords: fixed1.8
(In reply to comment #2)
> Are you sure the scrollbox doesn't already take that into consideration?

Just FYI: the scrollbox in fact didn't take this into consideration, which is
why we got Bug 308098. The patch over there however got a little closer to where
the problem actually occurred (ensureElementIsVisible got also called with a
null parameter from otherwhere). This patch here won't hurt, though.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: