Skip to content

Commit

Permalink
Core: fix IDocuments aboutToSave and saved filePath
Browse files Browse the repository at this point in the history
The function emiting those signals can be called with an empty file
path. Use the document file path in this case like in
TextDocument::saveImpl.

Change-Id: I9e3381999a25c49df1d5db060ef5467b12220ad4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
  • Loading branch information
davschul committed Aug 11, 2023
1 parent 28754ba commit 7bb49b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/coreplugin/idocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ IDocument::OpenResult IDocument::open(QString *errorString, const Utils::FilePat
*/
bool IDocument::save(QString *errorString, const Utils::FilePath &filePath, bool autoSave)
{
emit aboutToSave(filePath, autoSave);
emit aboutToSave(filePath.isEmpty() ? this->filePath() : filePath, autoSave);
const bool success = saveImpl(errorString, filePath, autoSave);
if (success)
emit saved(filePath, autoSave);
emit saved(filePath.isEmpty() ? this->filePath() : filePath, autoSave);
return success;
}

Expand Down

0 comments on commit 7bb49b5

Please sign in to comment.