зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1225923 - part 4 - fix AppendElement(nsDependentCString(...)) call in nsClipboardProxy.cpp; r=roc
I think the intent of this call is not to copy the flavor data passed in, but to simply convert it to a friendlier nsCString container for serializing to an IPC message. Since we won't be retaining references to the passed-in strings after this function returns, we can make the elements of our temporary array actually dependent strings, rather than creating temporary dependent strings that would need to be copied into the array.
This commit is contained in:
Родитель
eba0daa4d6
Коммит
dd84912fd6
|
@ -127,8 +127,9 @@ nsClipboardProxy::HasDataMatchingFlavors(const char **aFlavorList,
|
|||
*aHasType = false;
|
||||
|
||||
nsTArray<nsCString> types;
|
||||
nsCString* t = types.AppendElements(aLength);
|
||||
for (uint32_t j = 0; j < aLength; ++j) {
|
||||
types.AppendElement(nsDependentCString(aFlavorList[j]));
|
||||
t[j].Rebind(aFlavorList[j], nsCharTraits<char>::length(aFlavorList[j]));
|
||||
}
|
||||
|
||||
ContentChild::GetSingleton()->SendClipboardHasType(types, aWhichClipboard, aHasType);
|
||||
|
|
Загрузка…
Ссылка в новой задаче