forked from qt-creator/qt-creator
Utils: Don't call mutable expressions inside QTC_ASSERT
In order to conform to the theory: "Removing all QTC_ASSERTs and QTC_CHECKs should not change anything". Change-Id: I6f5c4486afb422301562d79c662fdde026e4d788 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -560,7 +560,8 @@ bool DesktopDeviceFileAccess::writeFileContents(
|
|||||||
qint64 offset) const
|
qint64 offset) const
|
||||||
{
|
{
|
||||||
QFile file(filePath.path());
|
QFile file(filePath.path());
|
||||||
QTC_ASSERT(file.open(QFile::WriteOnly | QFile::Truncate), return false);
|
const bool isOpened = file.open(QFile::WriteOnly | QFile::Truncate);
|
||||||
|
QTC_ASSERT(isOpened, return false);
|
||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
file.seek(offset);
|
file.seek(offset);
|
||||||
qint64 res = file.write(data);
|
qint64 res = file.write(data);
|
||||||
|
@@ -48,7 +48,8 @@ bool FSEngineImpl::open(QIODevice::OpenMode openMode)
|
|||||||
|
|
||||||
ensureStorage();
|
ensureStorage();
|
||||||
|
|
||||||
QTC_ASSERT(m_tempStorage->open(), return false);
|
const bool isOpened = m_tempStorage->open();
|
||||||
|
QTC_ASSERT(isOpened, return false);
|
||||||
|
|
||||||
bool read = openMode & QIODevice::ReadOnly;
|
bool read = openMode & QIODevice::ReadOnly;
|
||||||
bool write = openMode & QIODevice::WriteOnly;
|
bool write = openMode & QIODevice::WriteOnly;
|
||||||
@@ -76,7 +77,8 @@ bool FSEngineImpl::open(QIODevice::OpenMode openMode)
|
|||||||
|
|
||||||
bool FSEngineImpl::close()
|
bool FSEngineImpl::close()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(flush(), return false);
|
const bool isFlushed = flush();
|
||||||
|
QTC_ASSERT(isFlushed, return false);
|
||||||
if (m_tempStorage)
|
if (m_tempStorage)
|
||||||
m_tempStorage->close();
|
m_tempStorage->close();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -117,7 +117,8 @@ private:
|
|||||||
void handleFinished()
|
void handleFinished()
|
||||||
{
|
{
|
||||||
// In case the process is still running - wait until it has finished
|
// In case the process is still running - wait until it has finished
|
||||||
QTC_ASSERT(emitFinished(), QTimer::singleShot(m_reaperSetup.m_timeoutMs,
|
const bool isFinished = emitFinished();
|
||||||
|
QTC_ASSERT(isFinished, QTimer::singleShot(m_reaperSetup.m_timeoutMs,
|
||||||
this, &Reaper::handleFinished));
|
this, &Reaper::handleFinished));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +188,8 @@ private:
|
|||||||
Reaper *reaper = new Reaper(reaperSetup);
|
Reaper *reaper = new Reaper(reaperSetup);
|
||||||
connect(reaper, &Reaper::finished, this, [this, reaper, process = reaperSetup.m_process] {
|
connect(reaper, &Reaper::finished, this, [this, reaper, process = reaperSetup.m_process] {
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
QTC_CHECK(m_reaperList.removeOne(reaper));
|
const bool isRemoved = m_reaperList.removeOne(reaper);
|
||||||
|
QTC_CHECK(isRemoved);
|
||||||
delete reaper;
|
delete reaper;
|
||||||
delete process;
|
delete process;
|
||||||
if (m_reaperList.isEmpty())
|
if (m_reaperList.isEmpty())
|
||||||
|
Reference in New Issue
Block a user