syncqt: Close ifstream before attempt to remove file
ifstream may block the file descriptor in some operating systems. Wrap the reading of files in staging directory with extra scope, to make sure that ifstream closed the descriptor before the removal attempt. Also make sure that we closed the ifstream explicitly. Change-Id: I56ef5e9925501912d5cd61e8545f664e0a0d90b8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3115610cfa37b1341392039537299aea4a0b5d93) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9e1eb7ff69
commit
84dbb356ef
@ -740,9 +740,14 @@ public:
|
||||
== m_producedHeaders.end()) {
|
||||
// Check if header file came from another module as result of the cross-module
|
||||
// deprecation before removing it.
|
||||
std::ifstream input(entry.path(), std::ifstream::in);
|
||||
std::string firstLine;
|
||||
std::getline(input, firstLine);
|
||||
{
|
||||
std::ifstream input(entry.path(), std::ifstream::in);
|
||||
if (input.is_open()) {
|
||||
std::getline(input, firstLine);
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
if (firstLine.find("#ifndef DEPRECATED_HEADER_"
|
||||
+ m_commandLineArgs->moduleName())
|
||||
== 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user