Fix bug 74431

x2t doctrenderer and edit use the same CPdfFile instance
This commit is contained in:
Svetlana Kulikova
2025-06-02 16:17:57 +03:00
parent f570c88d29
commit 4f63982e2f
3 changed files with 9 additions and 1 deletions

View File

@ -109,6 +109,8 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
if (wsDstFile.empty() || !m_pInternal->pReader)
return false;
m_pInternal->pReader->CleanUp();
RELEASEOBJECT(m_pInternal->pWriter);
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, false, this, true, m_pInternal->wsTempFolder);

View File

@ -244,6 +244,11 @@ void CPdfReader::Clear()
delete pPDFContext;
m_vPDFContext.clear();
}
void CPdfReader::CleanUp()
{
while(UnmergePages());
m_eError = errNone;
}
bool CPdfReader::IsNeedCMap()
{
@ -682,7 +687,7 @@ bool CPdfReader::MergePages(const std::wstring& wsFile, const std::wstring& wsPa
}
bool CPdfReader::UnmergePages()
{
if (m_vPDFContext.size() < 1)
if (m_vPDFContext.size() <= 1)
return false;
CPdfReaderContext* pPDFContext = m_vPDFContext.back();
delete pPDFContext;

View File

@ -62,6 +62,7 @@ public:
bool LoadFromMemory(NSFonts::IApplicationFonts* pAppFonts, BYTE* data, DWORD length, const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
void Close();
void CleanUp();
void SetParams(COfficeDrawingPageParams* pParams);
std::wstring GetTempDirectory();