Index: fpdfsdk/src/fpdfsave.cpp |
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp |
index f56cc442f0ae162674e77a34bc7914fdeb5dd2f1..7a666bceb865055ae2b2c4f574e74023cf277e87 100644 |
--- a/fpdfsdk/src/fpdfsave.cpp |
+++ b/fpdfsdk/src/fpdfsave.cpp |
@@ -22,10 +22,12 @@ class CFX_IFileWrite final : public IFX_StreamWrite { |
public: |
CFX_IFileWrite(); |
FX_BOOL Init(FPDF_FILEWRITE* pFileWriteStruct); |
- virtual FX_BOOL WriteBlock(const void* pData, size_t size) override; |
- virtual void Release() override {} |
+ FX_BOOL WriteBlock(const void* pData, size_t size) override; |
+ void Release() override; |
protected: |
+ ~CFX_IFileWrite() override {} |
+ |
FPDF_FILEWRITE* m_pFileWriteStruct; |
}; |
@@ -49,6 +51,10 @@ FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) { |
return TRUE; |
} |
+void CFX_IFileWrite::Release() { |
+ delete this; |
+} |
+ |
#define XFA_DATASETS 0 |
#define XFA_FORMS 1 |
@@ -311,7 +317,6 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
bRet = FileMaker.Create(pStreamWrite, flags); |
_SendPostSaveToXFADoc(pDoc); |
- // pDoc->_ClearChangeMark(); |
for (int i = 0; i < fileList.GetSize(); i++) { |
IFX_FileStream* pFile = (IFX_FileStream*)fileList.GetAt(i); |
@@ -319,7 +324,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
} |
fileList.RemoveAll(); |
- delete pStreamWrite; |
+ pStreamWrite->Release(); |
return bRet; |
} |