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

Creating a Q_GLOBAL_STATIC that parents a QAbstractAnimation object causes assert failure on exit

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.7.0
    • 4.7.0
    • None
    • Tested on Linux
    • d97c42b7fdb4b370ec5a09ef5d6f04e2e22f241d

    Description

      Say an instance of ClassA is the parent of a QAbstractAnimation object, and Q_GLOBAL_STATIC is used to create an instance of ClassA. When the application is closed and the global static objects are deleted, if the animation is still running, the Q_ASSERT(runningLeafAnimations >= 0) in QUnifiedTimer::unregisterRunningAnimation() can fail.

      This happens if the unifiedTimer global static in qabstractanimation.cpp is deleted before the ClassA global static. When the ClassA parent deletes its QAbstractAnimation child, QAbstractAnimation internally calls QUnifiedTimer::instance(), which creates a new QUnifiedTimer instance since the global static has already been deleted. Then it calls QUnifiedTimer::unregisterRunningAnimation(), and the assert failure is triggered because runningLeafAnimations has not been incremented for the new instance of QUnifiedTimer.

      Attached is a small example.

      Attachments

        Issue Links

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

          Activity

            People

              vfm Thierry Bastian (closed Nokia identity) (Inactive)
              bealam Bea Lam (closed Nokia identity) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes