Closed
Bug 192024
Opened 23 years ago
Closed 23 years ago
Crash in nsComposerCommandsUpdater::SelectionIsCollapsed()
Categories
(Core :: DOM: Editor, defect)
Core
DOM: Editor
Tracking
()
VERIFIED
FIXED
People
(Reporter: mkaply, Assigned: mkaply)
Details
(Keywords: crash)
Attachments
(1 file, 2 obsolete files)
|
911 bytes,
patch
|
Brade
:
review+
kinmoz
:
superreview+
asa
:
approval1.3b+
|
Details | Diff | Splinter Review |
On reloading the testcase in http://bugzilla.mozilla.org/show_bug.cgi?id=191994
multiple times, I crashed.
I investigated it and found this code in nsComposerCommandsUpdater:
http://lxr.mozilla.org/seamonkey/source/editor/composer/src/nsComposerCommandsUpdater.cpp#371
if (NS_SUCCEEDED(mDOMWindow->GetSelection(getter_AddRefs(domSelection))))
{
PRBool selectionCollapsed = PR_FALSE;
domSelection->GetIsCollapsed(&selectionCollapsed);
return selectionCollapsed;
}
The problem is that GetSelection can return NS_OK even though domSelection is NULL.
We need a NULL check against domSelection before dereferencing. See:
http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#3455
this is where GetSelection ends up. Note that NS_OK is returned in multiple
cases without setting aSelection.
| Assignee | ||
Comment 1•23 years ago
|
||
Add nullcheck for domSelection.
With this patch, I am able to do multiple reloads, etc. without crashing.
| Assignee | ||
Updated•23 years ago
|
Attachment #113596 -
Flags: review?(brade)
Comment 2•23 years ago
|
||
Comment on attachment 113596 [details] [diff] [review]
Fix for problem
r=brade if you add an assertion for the null dom selection
(Kin already gave an sr= to a patch like this but he requested the assertion)
Attachment #113596 -
Flags: superreview?(kin)
Attachment #113596 -
Flags: review?(brade)
Attachment #113596 -
Flags: review+
Comment on attachment 113596 [details] [diff] [review]
Fix for problem
sr=kin@netscape.com
You can add an NS_WARNING(), my concern is that an assertion will be too
annoying in win32 debug builds.
The underlying problem is that the presShell is disappearing out from
underneath us because the document/page is hidden. I don't remember all the
details of why the editor doesn't hold a strong reference to the PresShell
though ... it was probably to break some dependency cycle.
Attachment #113596 -
Flags: superreview?(kin) → superreview+
| Assignee | ||
Comment 5•23 years ago
|
||
reference bug
http://bugzilla.mozilla.org/show_bug.cgi?id=182290
| Assignee | ||
Comment 6•23 years ago
|
||
I split out the null check so I could add an NS_WARNING
Attachment #113596 -
Attachment is obsolete: true
Comment 7•23 years ago
|
||
Comment on attachment 113602 [details] [diff] [review]
Patch with NS_WARNING
r=brade if you move the curly brace on this line to a new line (to be
consistent with other places):
+ if (domSelection) {
Attachment #113602 -
Flags: superreview?(kin)
Attachment #113602 -
Flags: review+
Comment 8•23 years ago
|
||
Sorry, may I ask a dumb question -- why domSelection checked for null after
GetSelection call? I always think that more reasonable would be made check
before usage, or I miss something?
Comment on attachment 113602 [details] [diff] [review]
Patch with NS_WARNING
I actually prefer your 1st patch, the warning could've been added after the
|if| block, just before the return, since we should never really get there.
Attachment #113602 -
Flags: superreview?(kin) → superreview-
| Assignee | ||
Comment 10•23 years ago
|
||
Original patch with NS_WARNING when we return FALSE
Attachment #113602 -
Attachment is obsolete: true
Comment 11•23 years ago
|
||
Comment on attachment 113604 [details] [diff] [review]
One more time
r=brade
Attachment #113604 -
Flags: superreview?(kin)
Attachment #113604 -
Flags: review+
Comment 12•23 years ago
|
||
Attachment #113604 -
Flags: superreview?(kin) → superreview+
| Assignee | ||
Comment 13•23 years ago
|
||
Comment on attachment 113604 [details] [diff] [review]
One more time
This is a crasher that we would like to get into 1.3b if we could.
Attachment #113604 -
Flags: approval1.3b?
Comment 14•23 years ago
|
||
Comment on attachment 113604 [details] [diff] [review]
One more time
a=asa (on behalf of drivers) for checkin to 1.3beta.
Attachment #113604 -
Flags: approval1.3b? → approval1.3b+
| Assignee | ||
Comment 15•23 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 16•23 years ago
|
||
using today's builds, i don't crash when reloading the test case in bug 191994.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•