For bug 68532

This commit is contained in:
Oleg Korshul
2024-07-08 01:53:47 +03:00
parent f70b5c0939
commit 4f0e3504d1
2 changed files with 18 additions and 2 deletions

View File

@ -352,7 +352,18 @@
} }
this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Page); this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Page);
let retValue = Module["_GetGlyphs"](this.nativeFile, pageIndex); let isCrashed = false;
let retValue = null;
try
{
retValue = Module["_GetGlyphs"](this.nativeFile, pageIndex);
}
catch (err)
{
retValue = null;
isCrashed = true;
}
// there is no need to delete the result; this buffer is used as a text buffer // there is no need to delete the result; this buffer is used as a text buffer
// for text commands on other pages. After receiving ALL text pages, // for text commands on other pages. After receiving ALL text pages,
// you need to call destroyTextInfo() // you need to call destroyTextInfo()
@ -362,10 +373,11 @@
{ {
// waiting fonts // waiting fonts
retValue = null; retValue = null;
isCrashed = false;
} }
if (null == retValue) if (null == retValue)
return null; return isCrashed ? [] : null;
let lenArray = new Int32Array(Module["HEAP8"].buffer, retValue, 5); let lenArray = new Int32Array(Module["HEAP8"].buffer, retValue, 5);
let len = lenArray[0]; let len = lenArray[0];

View File

@ -432,9 +432,11 @@ namespace PdfReader
if (bResult) if (bResult)
{ {
#ifndef BUILDING_WASM_MODULE
// Шрифт нашелся, но пока им пользоваться нельзя, потому что он загружается в параллельном потоке // Шрифт нашелся, но пока им пользоваться нельзя, потому что он загружается в параллельном потоке
while (!pEntry->bAvailable) while (!pEntry->bAvailable)
NSThreads::Sleep(10); NSThreads::Sleep(10);
#endif
} }
RELEASEOBJECT(pCS); RELEASEOBJECT(pCS);
@ -449,9 +451,11 @@ namespace PdfReader
if (bResult) if (bResult)
{ {
#ifndef BUILDING_WASM_MODULE
// Шрифт нашелся, но пока им пользоваться нельзя, потому что он загружается в параллельном потоке // Шрифт нашелся, но пока им пользоваться нельзя, потому что он загружается в параллельном потоке
while (!(*ppEntry)->bAvailable) while (!(*ppEntry)->bAvailable)
NSThreads::Sleep(10); NSThreads::Sleep(10);
#endif
} }
if (!bResult) if (!bResult)