зеркало из https://github.com/mozilla/pjs.git
Bug 319024 - Password manager does not remember data - regression from bug 316414 part 1 - observer enumerators need to hand out the strong-ref nsIObserver-implementing object, not the nsIWeakReference-implementing object, r=darin
Original committer: bsmedberg%covad.net Original revision: 1.11 Original date: 2005/12/13 21:12:38
This commit is contained in:
Родитель
a9e1afdb7d
Коммит
e33e61aeb4
|
@ -112,8 +112,7 @@ public:
|
|||
}
|
||||
|
||||
// specialized operator to make sure we make room for mValues
|
||||
void* operator new (size_t size, const nsCOMArray_base& aArray,
|
||||
PRBool aReverse) CPP_THROW_NEW;
|
||||
void* operator new (size_t size, const nsCOMArray_base& aArray) CPP_THROW_NEW;
|
||||
void operator delete(void* ptr) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
@ -173,8 +172,7 @@ nsCOMArrayEnumerator::GetNext(nsISupports** aResult)
|
|||
}
|
||||
|
||||
void*
|
||||
nsCOMArrayEnumerator::operator new (size_t size, const nsCOMArray_base& aArray,
|
||||
PRBool aReverse)
|
||||
nsCOMArrayEnumerator::operator new (size_t size, const nsCOMArray_base& aArray)
|
||||
CPP_THROW_NEW
|
||||
{
|
||||
// create enough space such that mValueArray points to a large
|
||||
|
@ -186,20 +184,15 @@ nsCOMArrayEnumerator::operator new (size_t size, const nsCOMArray_base& aArray,
|
|||
nsCOMArrayEnumerator * result =
|
||||
NS_STATIC_CAST(nsCOMArrayEnumerator*, ::operator new(size));
|
||||
|
||||
if (!result)
|
||||
return result;
|
||||
|
||||
// now need to copy over the values, and addref each one
|
||||
// now this might seem like a lot of work, but we're actually just
|
||||
// doing all our AddRef's ahead of time since GetNext() doesn't
|
||||
// need to AddRef() on the way out
|
||||
PRUint32 i;
|
||||
PRUint32 max = result->mArraySize = aArray.Count();
|
||||
PRUint32 cur = aReverse ? max - 1 : 0;
|
||||
PRUint32 incr = aReverse ? -1 : 1;
|
||||
|
||||
for (PRUint32 i = 0; i < max; ++i, cur += incr) {
|
||||
result->mValueArray[cur] = aArray[i];
|
||||
NS_IF_ADDREF(result->mValueArray[cur]);
|
||||
for (i = 0; i<max; i++) {
|
||||
result->mValueArray[i] = aArray[i];
|
||||
NS_IF_ADDREF(result->mValueArray[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -207,11 +200,9 @@ nsCOMArrayEnumerator::operator new (size_t size, const nsCOMArray_base& aArray,
|
|||
|
||||
extern NS_COM nsresult
|
||||
NS_NewArrayEnumerator(nsISimpleEnumerator* *aResult,
|
||||
const nsCOMArray_base& aArray,
|
||||
PRBool aReverse)
|
||||
const nsCOMArray_base& aArray)
|
||||
{
|
||||
nsCOMArrayEnumerator *enumerator =
|
||||
new (aArray, aReverse) nsCOMArrayEnumerator();
|
||||
nsCOMArrayEnumerator *enumerator = new (aArray) nsCOMArrayEnumerator();
|
||||
if (!enumerator) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult = enumerator);
|
||||
|
|
Загрузка…
Ссылка в новой задаче