https://bugs.kde.org/show_bug.cgi?id=516162

--- Comment #1 from Noah Davis <[email protected]> ---
It seems that the logic for loading tesseract may not be robust enough.

In case there's someone who can figure out a fix before me, here's some info
about the relevant code.
In spectacle/src/TesseractRuntimeLoader.cpp,
TesseractRuntimeLoader::loadLocked() calls
TesseractRuntimeLoader::candidateLibraryNames() to get a list of library names.

>QStringList TesseractRuntimeLoader::candidateLibraryNames() const
>{
>    return {QStringLiteral("libtesseract.so.5"), 
> QStringLiteral("libtesseract.so.4"), QStringLiteral("libtesseract.so")};
>}

In TesseractRuntimeLoader::loadLocked(), "m_library" is an instance of QLibrary
(https://doc.qt.io/qt-6/qlibrary.html).

>bool TesseractRuntimeLoader::loadLocked()
>{
>    const auto candidates = candidateLibraryNames();
>    for (const QString &candidate : candidates) {
>        m_library.setFileName(candidate);
>        m_library.setLoadHints(QLibrary::ExportExternalSymbolsHint | 
> QLibrary::PreventUnloadHint);
>
>        if (!m_library.load()) {
>            qCWarning(SPECTACLE_LOG) << "Unable to load Tesseract candidate" 
> << candidate << ':' << m_library.errorString();
>            continue;
>        }
>
>        qCInfo(SPECTACLE_LOG) << "Attempting to use Tesseract library" << 
> candidate;
>
>        if (!resolveSymbols()) {
>            m_library.unload();
>            continue;
>        }
>
>        if (!validateLoadedVersion()) {
>            m_library.unload();
>            continue;
>        }
>
>        m_loaded = true;
>        qCInfo(SPECTACLE_LOG) << "Loaded Tesseract runtime library from" << 
> m_library.fileName();
>        return true;
>    }
>
>    qCWarning(SPECTACLE_LOG) << "Unable to locate a suitable Tesseract shared 
> library";
>    return false;
>}

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to