This could leave you with a dangling pointer:

nsCStringKey key(nsPromiseFlatCString(aRef).get());

because the nsPromiseFlatCString object will go out of scope,
so do this instead:

  nsPromiseFlatCString flat(aRef);
  nsCStringKey key(flat.get());

sr=scc
This commit is contained in:
disttsc%bart.nl 2001-03-08 13:13:42 +00:00
Родитель 5c5de15b33
Коммит 42cb1adf93
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -160,7 +160,8 @@ nsXBLDocumentInfo::GetPrototypeBinding(const nsAReadableCString& aRef, nsIXBLPro
if (!mBindingTable)
return NS_OK;
nsCStringKey key(nsPromiseFlatCString(aRef).get());
nsPromiseFlatCString flat(aRef);
nsCStringKey key(flat.get());
*aResult = NS_STATIC_CAST(nsIXBLPrototypeBinding*, mBindingTable->Get(&key)); // Addref happens here.
return NS_OK;
@ -172,7 +173,8 @@ nsXBLDocumentInfo::SetPrototypeBinding(const nsAReadableCString& aRef, nsIXBLPro
if (!mBindingTable)
mBindingTable = new nsSupportsHashtable();
nsCStringKey key(nsPromiseFlatCString(aRef).get());
nsPromiseFlatCString flat(aRef);
nsCStringKey key(flat.get());
mBindingTable->Put(&key, aBinding);
return NS_OK;