Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.12.0
-
None
Description
I have a problem while tests my program by Catch2 - core dump in file `text/qfontdatabase.cpp`. I have core dump at line when is dereference of pointer `db`.
bool QFontDatabase::removeAllApplicationFonts() { QMutexLocker locker(fontDatabaseMutex()); QFontDatabasePrivate *db = privateDb(); // here not check passible nullptr if (db->applicationFonts.isEmpty()) return false; db->applicationFonts.clear(); db->invalidate(); return true; }
Function privatDb::openrator() can return nullptr, and here it does not check.
struct QGlobalStatic { typedef T Type; bool isDestroyed() const { return guard.load() <= QtGlobalStatic::Destroyed; } bool exists() const { return guard.load() == QtGlobalStatic::Initialized; } operator Type *() { if (isDestroyed()) return 0; return innerFunction(); } Type *operator()() { if (isDestroyed()) return 0; return innerFunction(); } Type *operator->() { Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", "The global static was used after being destroyed"); return innerFunction(); } Type &operator*() { Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", "The global static was used after being destroyed"); return *innerFunction(); } };