Index: ktexteditor-5.44.0/src/buffer/katesecuretextbuffer.cpp =================================================================== --- ktexteditor-5.44.0.orig/src/buffer/katesecuretextbuffer.cpp +++ ktexteditor-5.44.0/src/buffer/katesecuretextbuffer.cpp @@ -74,9 +74,7 @@ bool SecureTextBuffer::saveFileInternal( if (!tempFile.open()) { return false; } - tempFile.close(); - QString tempFileName = QFileInfo(tempFile).fileName(); - tempFile.setFileName(tempFileName); + if (!readFile.open(QIODevice::ReadOnly) || !tempFile.open()) { return false; } @@ -114,7 +112,7 @@ bool SecureTextBuffer::saveFileInternal( } // rename temporary file to the target file - if (moveFile(tempFileName, targetFileName)) { + if (moveFile(tempFile.fileName(), targetFileName)) { // temporary file was renamed, there is nothing to remove anymore tempFile.setAutoRemove(false); return true;