Fix for bug #56159 (Crash when sending after copy/paste with Spell Check enabled)

mozilla/editor/base/nsEditorShell.cpp
      - Make sure mSpellChecker is zeroed in Shutdown() just in case something went wrong.

    mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp
      - Added checks to prevent iterating over a collapsed selection in FistSelectedBlock() and LastSelectedBlock().

r=brade@netscape.com sr,a=sfraser@netscape.com
This commit is contained in:
kin%netscape.com 2000-10-16 14:31:48 +00:00
parent 203701d99a
commit 44e24f1173
4 changed files with 76 additions and 0 deletions

View File

@ -315,6 +315,10 @@ nsEditorShell::Shutdown()
editor->PreDestroy();
}
// Make sure we blow the spellchecker away, just in
// case it hasn't been destroyed already.
mSpellChecker = nsnull;
if (mDocShell)
mDocShell->SetParentURIContentListener(nsnull);

View File

@ -315,6 +315,10 @@ nsEditorShell::Shutdown()
editor->PreDestroy();
}
// Make sure we blow the spellchecker away, just in
// case it hasn't been destroyed already.
mSpellChecker = nsnull;
if (mDocShell)
mDocShell->SetParentURIContentListener(nsnull);

View File

@ -716,6 +716,23 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus,
return result;
}
result = range->GetCollapsed(&isCollapsed);
if (NS_FAILED(result))
{
UNLOCK_DOC(this);
return result;
}
if (isCollapsed)
{
// If we get here, the range is collapsed because there is nothing before
// the caret! Just return NS_OK;
UNLOCK_DOC(this);
return NS_OK;
}
result = CreateContentIterator(range, getter_AddRefs(iter));
if (NS_FAILED(result))
@ -1223,6 +1240,23 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P
return result;
}
result = range->GetCollapsed(&isCollapsed);
if (NS_FAILED(result))
{
UNLOCK_DOC(this);
return result;
}
if (isCollapsed)
{
// If we get here, the range is collapsed because there is nothing after
// the caret! Just return NS_OK;
UNLOCK_DOC(this);
return NS_OK;
}
result = CreateContentIterator(range, getter_AddRefs(iter));
if (NS_FAILED(result))

View File

@ -716,6 +716,23 @@ nsTextServicesDocument::FirstSelectedBlock(TSDBlockSelectionStatus *aSelStatus,
return result;
}
result = range->GetCollapsed(&isCollapsed);
if (NS_FAILED(result))
{
UNLOCK_DOC(this);
return result;
}
if (isCollapsed)
{
// If we get here, the range is collapsed because there is nothing before
// the caret! Just return NS_OK;
UNLOCK_DOC(this);
return NS_OK;
}
result = CreateContentIterator(range, getter_AddRefs(iter));
if (NS_FAILED(result))
@ -1223,6 +1240,23 @@ nsTextServicesDocument::LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, P
return result;
}
result = range->GetCollapsed(&isCollapsed);
if (NS_FAILED(result))
{
UNLOCK_DOC(this);
return result;
}
if (isCollapsed)
{
// If we get here, the range is collapsed because there is nothing after
// the caret! Just return NS_OK;
UNLOCK_DOC(this);
return NS_OK;
}
result = CreateContentIterator(range, getter_AddRefs(iter));
if (NS_FAILED(result))