qlockfile_unix - code cleanup
Coverity's CID 157687: QCache::insert, indeed, can delete (immediately) the object we're trying to insert. While this never happens actually in qlockfile_unix since we have max cost 10 and insert with cost 1, the code does not look good and Coverity is not happy. Change-Id: I16a428017bf86e151afe5256906e4cab1ef4044a Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>bb10
parent
eb786d600c
commit
ea64dc9a11
|
|
@ -139,12 +139,14 @@ static bool fcntlWorksAfterFlock(const QString &fn)
|
|||
if (fcntlOK.isDestroyed())
|
||||
return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
|
||||
bool *worksPtr = fcntlOK->object(fn);
|
||||
if (!worksPtr) {
|
||||
worksPtr = new bool(QLockFilePrivate::checkFcntlWorksAfterFlock(fn));
|
||||
fcntlOK->insert(fn, worksPtr);
|
||||
}
|
||||
if (worksPtr)
|
||||
return *worksPtr;
|
||||
|
||||
return *worksPtr;
|
||||
const bool val = QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
|
||||
worksPtr = new bool(val);
|
||||
fcntlOK->insert(fn, worksPtr);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool setNativeLocks(const QString &fileName, int fd)
|
||||
|
|
|
|||
Loading…
Reference in New Issue