Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Weird crash with QGesture
Qt 6.11 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 3.9k 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.
  • A Offline
    A Offline
    achard.ju
    wrote on last edited by
    #1

    Hi every one !

    First of all, i am using Qt 4.8.6 64 bit under debian 8.

    I have a weird crash while deleting some of my widgets, in the Qt Code. This is a gdb print of the generated core :

    	qDeleteAll<QSet<QGesture*>::const_iterator>		322	0x7f34a91da4cd	
    	qDeleteAll<QSet<QGesture*> >		330	0x7f34a91da4cd	
    	QGestureManager::filterEventThroughContexts		389	0x7f34a91da4cd	
    	QGestureManager::filterEvent		496	0x7f34a91dd205	
    	QApplication::notify		3916	0x7f34a917f4ea	
    	QCoreApplication::notifyInternal		955	0x7f34a8c4871d	
    	sendEvent		231	0x7f34a91cb1ee	
    	QWidget::~QWidget		1699	0x7f34a91cb1ee	
    	QWidget::~QWidget		1703	0x7f34a91cb489	
    	QObjectPrivate::deleteChildren		1935	0x7f34a8c60248	
    	QWidget::~QWidget		1679	0x7f34a91cb173
    

    I am not using QGesture at all in the project by the way.

    The code called is in QGestureManager.cpp line 389 :

        //Clean up the Gestures
        qDeleteAll(m_gesturesToDelete);
    

    Does anyone understand this ?

    1 Reply Last reply
    0
    • 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 Extensions
                        • Unsolved