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

Qt Symbian leaks RTimer handles.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 4.7.2
    • 4.7.1
    • Core: Event loop
    • None
    • 2b1b617664bfc78f6e95e53dc0f9749bd1f2d27a

      QEventDispatcherSymbian leaks RTimer handles.

      Normally RTimer handle allocation/release goes like this:
      1. QEventDispatcherSymbian::registerTimer() creates RTimer handle by calling QTimerActiveObject::Start()
      2. QEventDispatcherSymbian::unregisterTimer() deletes QTimerActiveObject
      3. QTimerActiveObject::~QTimerActiveObject() calls CActive::Close()
      4. CActive calls QTimerActiveObject::DoCancel() which then releases the RTimer handle

      However:

      • CActive calls DoCancel only if it is in "active" status
      • Sometimes CActive is not active when unregisterTimer() is called
        -> DoCancel never gets called
        -> RTimer handle never gets released

      The m_rTimer.Close() should be called in QTimerActiveObject::~QTimerActiveObject() and not in DoCancel().

      It takes some strange combination of QEvents to cause CActive not to be active when unregisterTimer is called, so it's quite hard to reproduce. However this happens quite regularly on our multi-threaded application (verified with debugger that this is the source of the leak).

      I attached an image which displays how system's RTimer handle count increases steadily when creating and destroying our widget that leads to this bug. (The drop in the end is because our application was closed) ( thanks to Janne Karjalainen for this image )

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

            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            snurmenn Sami Nurmenniemi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes