Commit a8bcf7a6 authored by Arnaud Ruiz's avatar Arnaud Ruiz Committed by Michael Reeves

Fix for "Too many open files" bug

kdiff3 fails to close files properly leading to stability and speed issues.

Reviewers: mreeves

Reviewed By: mreeves

Differential Revision: https://phabricator.kde.org/D22294
parent 10b9226f
......@@ -400,6 +400,7 @@ bool MergeFileInfos::fastFileComparison(
if(!fi2.open(QIODevice::ReadOnly))
{
fi1.close();
status = fi2.errorString();
return bEqual;
}
......@@ -417,25 +418,32 @@ bool MergeFileInfos::fastFileComparison(
if(len != fi1.read(&buf1[0], len))
{
status = fi1.errorString();
fi1.close();
fi2.close();
return bEqual;
}
if(len != fi2.read(&buf2[0], len))
{
status = fi2.errorString();
;
fi1.close();
fi2.close();
return bEqual;
}
if(memcmp(&buf1[0], &buf2[0], len) != 0)
{
bError = false;
fi1.close();
fi2.close();
return bEqual;
}
sizeLeft -= len;
//pp.setCurrent(double(fullSize-sizeLeft)/fullSize, false );
pp.step();
}
fi1.close();
fi2.close();
// If the program really arrives here, then the files are really equal.
bError = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment