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

`QObject::startTimer` triggers a call to a GGlobalStatic when it is no longer valid and causes application to crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • None
    • 5.12.3
    • QPA: Wayland
    • None
    • Linux/Wayland

    Description

      I'm debugging a popular application[1] crash when running under Wayland/FlatPak. And I've traced the problem down to Qt I think.

      There are 23 threads at the moment of the crash. All but one of them are blocked at a poll() or pthread_cond_wait().

      The crashing thread's backtrace is this: https://pastebin.com/An9wDXM2

      Examining the backtrace, I get to know that QObject::startTimer() will trigger a call to QAbstractEventDispatcherPrivate::allocateTimerId() whose body is:

      {
          return timerIdFreeList()->next();
      }
      

      timerIdFreeList() returns the NULL and causes the app to crash. timerIdFreeList is declared as:

      typedef QFreeList<void, QtTimerIdFreeListConstants> QtTimerIdFreeList;
      Q_GLOBAL_STATIC(QtTimerIdFreeList, timerIdFreeList)
      

      Taking a look at Q_GLOBAL_STATIC, I've got the impression that it should never return NULL as long as the application doesn't exit. Maybe the application was already on some exit-cycle and stange shutdown order led to this issue. I'd like hints on how to proceed to debug this issue.

      [1] Telegram Desktop

      Attachments

        For Gerrit Dashboard: QTBUG-75779
        # Subject Branch Project Status CR V

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            vinipsmaker Vinícius dos Santos Oliveira
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes