Fix an eventual memory leak
parent
b1e1361189
commit
d4d4163cb3
|
@ -801,8 +801,6 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||
Document doc = buf->getDocument();
|
||||
Utf8_16_Read UnicodeConvertor;
|
||||
|
||||
char* data = new char[blockSize + 8]; // +8 for incomplete multibyte char
|
||||
|
||||
LoadedFileFormat loadedFileFormat;
|
||||
loadedFileFormat._encoding = buf->getEncoding();
|
||||
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.
|
||||
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
|
||||
|
||||
|
||||
//Get file size
|
||||
FILE* fp = _wfopen(buf->getFullPathName(), TEXT("rb"));
|
||||
if (!fp)
|
||||
|
@ -819,6 +816,8 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||
_fseeki64(fp, 0, SEEK_END);
|
||||
int64_t fileSize = _ftelli64(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
|
||||
bool res = loadFileData(doc, fileSize, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat);
|
||||
|
|
Loading…
Reference in New Issue