mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 13:54:54 +02:00
Fix an eventual memory leak
This commit is contained in:
parent
b1e1361189
commit
d4d4163cb3
@ -801,8 +801,6 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||||||
Document doc = buf->getDocument();
|
Document doc = buf->getDocument();
|
||||||
Utf8_16_Read UnicodeConvertor;
|
Utf8_16_Read UnicodeConvertor;
|
||||||
|
|
||||||
char* data = new char[blockSize + 8]; // +8 for incomplete multibyte char
|
|
||||||
|
|
||||||
LoadedFileFormat loadedFileFormat;
|
LoadedFileFormat loadedFileFormat;
|
||||||
loadedFileFormat._encoding = buf->getEncoding();
|
loadedFileFormat._encoding = buf->getEncoding();
|
||||||
loadedFileFormat._eolFormat = EolType::unknown;
|
loadedFileFormat._eolFormat = EolType::unknown;
|
||||||
@ -811,7 +809,6 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||||||
buf->setLoadedDirty(false); // Since the buffer will be reloaded from the disk, and it will be clean (not dirty), we can set _isLoadedDirty false safetly.
|
buf->setLoadedDirty(false); // Since the buffer will be reloaded from the disk, and it will be clean (not dirty), we can set _isLoadedDirty false safetly.
|
||||||
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
|
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
|
||||||
|
|
||||||
|
|
||||||
//Get file size
|
//Get file size
|
||||||
FILE* fp = _wfopen(buf->getFullPathName(), TEXT("rb"));
|
FILE* fp = _wfopen(buf->getFullPathName(), TEXT("rb"));
|
||||||
if (!fp)
|
if (!fp)
|
||||||
@ -820,6 +817,8 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||||||
int64_t fileSize = _ftelli64(fp);
|
int64_t fileSize = _ftelli64(fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
char* data = new char[blockSize + 8]; // +8 for incomplete multibyte char
|
||||||
|
|
||||||
buf->_canNotify = false; //disable notify during file load, we don't want dirty status to be triggered
|
buf->_canNotify = false; //disable notify during file load, we don't want dirty status to be triggered
|
||||||
bool res = loadFileData(doc, fileSize, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat);
|
bool res = loadFileData(doc, fileSize, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat);
|
||||||
buf->_canNotify = true;
|
buf->_canNotify = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user