mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-22 20:10:36 +00:00
Fix PDFium abuse that leads to a crash on Windows ARM (#3460)
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
@@ -1209,7 +1209,6 @@ public:
|
||||
FPDF_ClosePage(m_page);
|
||||
if (m_doc)
|
||||
FPDF_CloseDocument(m_doc);
|
||||
FPDF_DestroyLibrary();
|
||||
}
|
||||
|
||||
int page() const override { return m_currentPage; }
|
||||
@@ -1224,7 +1223,7 @@ private:
|
||||
return std::nullopt;
|
||||
|
||||
if (m_page)
|
||||
FPDF_ClosePage(m_page);
|
||||
FPDF_ClosePage(std::exchange(m_page, nullptr));
|
||||
m_page = FPDF_LoadPage(m_doc, m_currentPage++);
|
||||
if (!m_page)
|
||||
throw std::runtime_error("Failed to load page.");
|
||||
|
@@ -181,5 +181,9 @@ int main(int argc, char *argv[])
|
||||
// Otherwise, we can get a heap-use-after-free inside of llama.cpp.
|
||||
ChatListModel::globalInstance()->destroyChats();
|
||||
|
||||
#ifndef GPT4ALL_USE_QTPDF
|
||||
FPDF_DestroyLibrary();
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user