Closed Bug 236659 Opened 20 years ago Closed 20 years ago

Crash in nsAutoCompleteController when using URL bar autocomplete too soon after startup

Categories

(Firefox :: Address Bar, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: lorenzo, Assigned: lorenzo)

Details

(Keywords: crash)

Attachments

(4 files, 2 obsolete files)

If you try to use URL bar autocomplete too soon after firefox starts, it crashes.

Reproducible: always (if you're fast enough).

1. Start Firefox
2. As soon as the browser appears, very quickly type a letter (e.g. y), then
press down arrow, then press enter. Note: you have to be very quick to see this.

Actual results:
1. The status bar shows "Resolving host y"
2. Firefox crashes

Expected results: No crash

I'm setting severity to normal since it's hard to trigger and there's no data
loss (the browser has just started up).
Attached file Stack from debug build
Stack trace from debug build
Severity: normal → critical
The crash is due to dereferencing a NULL mInput in ClosePopup(), but I *think*
the root cause is that StartSearchTimer() is called a second time before
Notify() is called for the the first search.

The following text files contain a log of all nsAutoCompleteController::<xxx>
functions that are called when it crashes (if the keys are pressed too soon
after startup) and when it doesn't (if the same keys are pressed a bit later).
Severity: critical → normal
bugzilla@spray.se: sorry for that midair collision. :)

I don't think this is critical since (a) it's so hard to trigger and (b) there's
no real dataloss since the browser has just started up. This is more of a polish
issue.
Since it's a timing issue, here is a list of all nsAutoCompleteController
member functions called when the crash occurs. This was obtained on a debug
build via printfs in the code and "firefox -console"
Same as above, but with the keys pressed a litte slower and no crash.
Attached patch Wallpaper patch (obsolete) — Splinter Review
This fixes the problem for me.

It seems to work fine, but I don't know if it's the correct approach.
Comment on attachment 143111 [details] [diff] [review]
Wallpaper patch

Requesting review so that someone else can look at it.
Attachment #143111 - Flags: review?(bryner)
I haven't debugged this, but...  it seems like the root of the problem is that
we should not allow a second timer to be created if we're still waiting on our
current timer to fire.  We attempt to cancel the timer but we end up cancelling
only the second one since we no longer have a reference to the first one.

In other words, how about just making StartSearchTimer return immediately if
mTimer is not null?
Attached patch Patch as suggested by bryner (obsolete) — Splinter Review
bryner, this patch does what you suggested. It fixes the crash for me.
Attachment #143111 - Attachment is obsolete: true
Same as above, except without typos. :)
Attachment #143201 - Attachment is obsolete: true
Attachment #143202 - Flags: review?(bryner)
Attachment #143111 - Flags: review?(bryner) → review-
Comment on attachment 143202 [details] [diff] [review]
Same patch without typos

Looks good, my only comment is to make the |if| style match what is used
elsewhere in the file:

if (!mTimer) {

I'll go ahead and fix that and check it in.  Thanks for the patch.
Attachment #143202 - Flags: review?(bryner) → review+
Ended up making another change to put the GetTimeout stuff inside the |if|, and
tweaked the comment a bit.  Checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
bryner, thanks for the quick turnaround!
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: bugs → lorenzo
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Reassigning for credit. Please excuse the spam.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: