Fix to account for the fact that nsISupportsArray returns PRBools for some inteface methods. r=akkana, jfrancis.

This commit is contained in:
sfraser%netscape.com 2000-01-18 21:02:12 +00:00
Родитель f49da0a0b2
Коммит 6b03d0450c
1 изменённых файлов: 3 добавлений и 4 удалений

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

@ -1725,7 +1725,7 @@ nsRangeList::AddSelectionListener(nsIDOMSelectionListener* inNewListener)
nsresult result; nsresult result;
nsCOMPtr<nsISupports> isupports = do_QueryInterface(inNewListener , &result); nsCOMPtr<nsISupports> isupports = do_QueryInterface(inNewListener , &result);
if (NS_SUCCEEDED(result)) if (NS_SUCCEEDED(result))
result = mSelectionListeners->AppendElement(isupports); // addrefs result = mSelectionListeners->AppendElement(isupports) ? NS_OK : NS_ERROR_FAILURE; // addrefs
return result; return result;
} }
@ -1739,7 +1739,7 @@ nsRangeList::RemoveSelectionListener(nsIDOMSelectionListener* inListenerToRemove
if (!inListenerToRemove ) if (!inListenerToRemove )
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsISupports> isupports = do_QueryInterface(inListenerToRemove); nsCOMPtr<nsISupports> isupports = do_QueryInterface(inListenerToRemove);
return mSelectionListeners->RemoveElement(isupports); // releases return mSelectionListeners->RemoveElement(isupports) ? NS_OK : NS_ERROR_FAILURE; // releases
} }
@ -1784,9 +1784,8 @@ nsRangeList::NotifySelectionListeners()
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
for (PRUint32 i = 0; i < cnt;i++) for (PRUint32 i = 0; i < cnt;i++)
{ {
nsCOMPtr<nsIDOMSelectionListener> thisListener;
nsCOMPtr<nsISupports> isupports(dont_AddRef(mSelectionListeners->ElementAt(i))); nsCOMPtr<nsISupports> isupports(dont_AddRef(mSelectionListeners->ElementAt(i)));
thisListener = do_QueryInterface(isupports); nsCOMPtr<nsIDOMSelectionListener> thisListener = do_QueryInterface(isupports);
if (thisListener) if (thisListener)
thisListener->NotifySelectionChanged(); thisListener->NotifySelectionChanged();
} }