bug=34896 extra check for null in caret. this can happen sometimes when frame is destroyed in odd order. r=hyatt.

This commit is contained in:
mjudge%netscape.com 2000-06-07 01:18:41 +00:00
Родитель 98c38f889f
Коммит 4e644bbf60
2 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -337,7 +337,9 @@ NS_IMETHODIMP nsCaret::NotifySelectionChanged(nsIDOMDocument *, nsIDOMSelection
{ {
if (mVisible) if (mVisible)
StopBlinking(); StopBlinking();
mDomSelectionWeak = getter_AddRefs( NS_GetWeakReference(aDomSel) ); // weak reference to pres shell nsCOMPtr<nsIDOMSelection> domSel(do_QueryReferent(mDomSelectionWeak));
if (domSel.get() != aDomSel)
return NS_OK; //ignore this then.
if (mVisible) if (mVisible)
StartBlinking(); StartBlinking();
@ -556,6 +558,8 @@ PRBool nsCaret::MustDrawCaret()
return PR_TRUE; return PR_TRUE;
nsCOMPtr<nsIDOMSelection> domSelection = do_QueryReferent(mDomSelectionWeak); nsCOMPtr<nsIDOMSelection> domSelection = do_QueryReferent(mDomSelectionWeak);
if (!domSelection)
return PR_FALSE;
PRBool isCollapsed; PRBool isCollapsed;
if (NS_FAILED(domSelection->GetIsCollapsed(&isCollapsed))) if (NS_FAILED(domSelection->GetIsCollapsed(&isCollapsed)))

Просмотреть файл

@ -337,7 +337,9 @@ NS_IMETHODIMP nsCaret::NotifySelectionChanged(nsIDOMDocument *, nsIDOMSelection
{ {
if (mVisible) if (mVisible)
StopBlinking(); StopBlinking();
mDomSelectionWeak = getter_AddRefs( NS_GetWeakReference(aDomSel) ); // weak reference to pres shell nsCOMPtr<nsIDOMSelection> domSel(do_QueryReferent(mDomSelectionWeak));
if (domSel.get() != aDomSel)
return NS_OK; //ignore this then.
if (mVisible) if (mVisible)
StartBlinking(); StartBlinking();
@ -556,6 +558,8 @@ PRBool nsCaret::MustDrawCaret()
return PR_TRUE; return PR_TRUE;
nsCOMPtr<nsIDOMSelection> domSelection = do_QueryReferent(mDomSelectionWeak); nsCOMPtr<nsIDOMSelection> domSelection = do_QueryReferent(mDomSelectionWeak);
if (!domSelection)
return PR_FALSE;
PRBool isCollapsed; PRBool isCollapsed;
if (NS_FAILED(domSelection->GetIsCollapsed(&isCollapsed))) if (NS_FAILED(domSelection->GetIsCollapsed(&isCollapsed)))