Fix file manager memory leak in case of out of disk space.

File manager uses its Scintilla view (with its default document) to save and load file so these 2 op won't be done on foreground.
The fix decreases the  reference of document to save correctly while the failure of saving (out of disk space).

Close #5659
This commit is contained in:
Pavel Nedev 2019-05-16 11:54:42 +03:00 committed by Don HO
parent 1cd454a8d5
commit 4988ee3fd3
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1029,6 +1029,8 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
// Note that fwrite() doesn't return the number of bytes written, but rather the number of ITEMS.
if (items_written != 1)
{
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
if (error_msg != NULL)
*error_msg = TEXT("Failed to save file.\nNot enough space on disk to save file?");