Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73996

Bug in QFontDataBase

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.12.0
    • Core: Other
    • None
    • All

    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();
          }
      };
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            levkovitch Andrej Levkovitch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes