зеркало из https://github.com/mozilla/moz-skia.git
Work around SkString::gEmptyRec->writable_str() is unwritable.
See https://code.google.com/p/skia/issues/detail?id=1989 R=reed@google.com Review URL: https://codereview.chromium.org/128463002 git-svn-id: http://skia.googlecode.com/svn/trunk@12961 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
a52209f162
Коммит
fa8afda250
|
@ -68,6 +68,15 @@ static HRESULT wchar_to_skstring(WCHAR* name, SkString* skname) {
|
|||
"Could not get length for utf-8 to wchar conversion.");
|
||||
}
|
||||
skname->resize(len - 1);
|
||||
|
||||
// TODO: remove after https://code.google.com/p/skia/issues/detail?id=1989 is fixed.
|
||||
// If we resize to 0 then the skname points to gEmptyRec (the unique empty SkString::Rec).
|
||||
// gEmptyRec is static const and on Windows this means the value is in a read only page.
|
||||
// Writing to it in the following call to WideCharToMultiByte will cause an access violation.
|
||||
if (1 == len) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, name, -1, skname->writable_str(), len, NULL, NULL);
|
||||
if (0 == len) {
|
||||
HRM(HRESULT_FROM_WIN32(GetLastError()), "Could not convert utf-8 to wchar.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче