Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Weird crash with QGesture
Qt 6.12 LTS is out! See what's new in the release blog

Weird crash with QGesture

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 2 Posters 5.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    How are you deleting your widget ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • A Offline
      A Offline
      achard.ju
      wrote on last edited by
      #3

      Hi,

      function close() is called in a slot. Then an event (deferredDelete) actually call delete on the widget.
      This widget is embedded in a MDIArea.

      It's not happening at every close of the widget.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        achard.ju
        wrote on last edited by
        #4

        I switched from the Qt 4.8.6 from debian package to a 4.8.6 builded from source with the define QT_NO_GESTURES.
        The crash seems to be avoided.

        Is there a way to disable all the treatment that Qt do for Gesture management, as we do not use them in our project, without compiling from source ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Something's not clear, you are calling close and then deleteLater on your widget ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            achard.ju
            wrote on last edited by achard.ju
            #6

            No, i think that the close() call implicate a DeferedDelete event (Qt mechanism).

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #7

              No it doesn't unless you have set the theQt::WA_DeleteOnClose attribute. Otherwise it hides the widget.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • A Offline
                A Offline
                achard.ju
                wrote on last edited by
                #8

                Yes, the attribute is actually set .

                By the way, i have found another way to reproduce the problem and this time i initiate the delete of the widget manually, without close().

                The idea is :
                i have a QSplitter, the QSplitter is used as a container for 2 widgets. The two widgets are called "upper" and "bottom" area. The upper part in this case contains a list of items. When user click an item, we display a "bottom" part with details on the item selected in the "upper" part.
                The crash happens (sometimes) when we switch the "bottom" part.

                In this code, m_pBottomArea is the current bottom, pNewBottomArea is the one we want to set.

                    if (m_pBottomArea != NULL)
                    {
                        //Already a bottom: delete it, this will remove it from splitter
                        delete m_pBottomArea;
                        //m_pBottomArea->deleteLater;
                    }
                
                    m_pBottomArea = pNewBottomArea;
                
                    if (m_pBottomArea != NULL)
                    {
                        //Add the bottom
                        m_pSplitter->insertWidget(1, m_pBottomArea);
                    }
                
                

                Either if i use a delete, or a deleteLater, there is sometimes a crash. Always with the same call stack.

                Did i do something wrong ?
                Do you know if there is a way to disable the GestureManager without compiling Qt from source ?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  AFAIK, no.

                  One thing you can try is to set m_pBottomArea's parent to nullptr before deleting it.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    achard.ju
                    wrote on last edited by
                    #10

                    Already tried that :(

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Can you share the complete implementation of the function where you manipulate m_pBottomArea ? The handling pNewBottomArea is absent and the look of the code looks like it might be more complicated that necessary.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt
                      • Unsolved