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

Cannot unregister QGestureRecognizer without access violation

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      7d73d4b9a93b3132c1a24aa3ae77f0a307e821fd (qt/qtbase/5.13) d1b009cbbb06716a6c953184380c84e1cb4fbbf1 (qt/qtbase/5.12)

      Description

      When unregistering Qt-GestureRecognizers, e.g. with

      QGestureRecognizer::unregisterRecognizer(Qt::PanGesture);

      the recognizers are not completely released. They are just moved to 
      m_deletedRecognizers/m_obsoleteGestures. Thus is not a problem - yet. Probably the bug could be there.

      After this, destroying the QApplication (and implicitly the QGestureManager), it causes them to
      delete the object of recognizers _before_ it can be delete the obsolete ones.

      See qgesturemanager.cpp:

      QGestureManager::~QGestureManager()
      {
        qDeleteAll(m_recognizers);
        // ^--^ implies deleting the Keys used in m_obsoleteGestures.
      
        foreach (QGestureRecognizer *recognizer, m_obsoleteGestures.keys()) {
           // does not crash, but the value is no longer valid        
           qDeleteAll(m_obsoleteGestures.value(recognizer)); 
      
           delete recognizer; // Access violation now
        }
        m_obsoleteGestures.clear();
      }

       

      Where is the error?

      Problem should be reproducible with the smallest Qt-Example and did not appear in Qt 5.9.

       

        Attachments

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

          Activity

            People

            Assignee:
            andysh Andy Shaw
            Reporter:
            roalter Luis Roalter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes