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. Segmentation fault when exiting when linked against Qt 6.9.1
Forum Updated to NodeBB v4.3 + New Features

Segmentation fault when exiting when linked against Qt 6.9.1

Scheduled Pinned Locked Moved Solved General and Desktop
32 Posts 6 Posters 1.7k Views 3 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.
  • l3u_L Offline
    l3u_L Offline
    l3u_
    wrote last edited by
    #14

    @Axel-Spoerl Hi, nice to meet the right guy at once ;-)

    I meanwhile filed a bug report about this: https://bugreports.qt.io/browse/QTBUG-137755

    For all dock widgets I first instatiate a widget, like this (all are simple QWidgets – with quite complex stuff inside, but still):

    m_registrationPage = new RegistrationPage(this, m_sharedObjects);
    ...
    

    then, I create the dock, format it, set the widget and hide it, like this:

    m_playersDock = new QDockWidget(tr("Anmeldung"), this);
    m_playersDock->setWidget(m_registrationPage);
    formatDockWidget(m_playersDock, QStringLiteral("playersDock"));
    addDockWidget(Qt::TopDockWidgetArea, m_playersDock);
    connect(m_registrationPage, &RegistrationPage::raiseMe, m_playersDock, &QDockWidget::raise);
    m_playersDock->hide();
    

    Where the formatting is:

    void MainWindow::formatDockWidget(QDockWidget *dock, const QString &id)
    {
        dock->setObjectName(id);
        dock->setContextMenuPolicy(Qt::PreventContextMenu);
        dock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
    }
    

    When I start the program, all docks are hidden. If I close it again in this state, I get no segfault.

    Opening a database makes them show up, by default attached to the main window and tabbed. When closing the program then, the segfault happens.

    Interestingly, if I close my database again, the docks are hidden again – but still, I get a segfault on closing.

    1 Reply Last reply
    1
    • l3u_L Offline
      l3u_L Offline
      l3u_
      wrote last edited by l3u_
      #15

      Btw. I didn't change this code since Qt 5.6 back in 2017 …

      1 Reply Last reply
      0
      • Axel SpoerlA Offline
        Axel SpoerlA Offline
        Axel Spoerl
        Moderators
        wrote last edited by
        #16

        Hm. Looks like I went too far and we have to revert or follow up on this patch.
        Can you do me a favor: Report it as a bug, assign it to me? I'll fix it this week.

        Software Engineer
        The Qt Company, Oslo

        1 Reply Last reply
        2
        • l3u_L Offline
          l3u_L Offline
          l3u_
          wrote last edited by
          #17

          I already filed one here: https://bugreports.qt.io/browse/QTBUG-137755 – I can't assign it to you though (or better said, I don't know how to do that …)

          Somebody already commented on it, and mentioned these two PRs:
          https://codereview.qt-project.org/c/qt/qtbase/+/637198
          https://codereview.qt-project.org/c/qt/qtbase/+/636652

          SGaistS 1 Reply Last reply
          0
          • l3u_L l3u_

            I already filed one here: https://bugreports.qt.io/browse/QTBUG-137755 – I can't assign it to you though (or better said, I don't know how to do that …)

            Somebody already commented on it, and mentioned these two PRs:
            https://codereview.qt-project.org/c/qt/qtbase/+/637198
            https://codereview.qt-project.org/c/qt/qtbase/+/636652

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote last edited by
            #18

            @l3u_ done for you :-)

            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
            1
            • l3u_L Offline
              l3u_L Offline
              l3u_
              wrote last edited by
              #19

              Thanks :-)

              1 Reply Last reply
              0
              • l3u_L Offline
                l3u_L Offline
                l3u_
                wrote last edited by l3u_
                #20

                Just to also leave this here: I meanwhile could strip it down to a minimal example producing the crash, cf. the sources attached to https://bugreports.qt.io/browse/QTBUG-137755

                Produces the crash reliably when linked against Qt 6.9.1. You have to run the program twice: The first time, it exits normally. The second time, when the window geometry and state are restored, it segfaults on exiting.

                No delete, no deleteLater, nothing special at all …

                1 Reply Last reply
                0
                • Axel SpoerlA Offline
                  Axel SpoerlA Offline
                  Axel Spoerl
                  Moderators
                  wrote last edited by Axel Spoerl
                  #21

                  Great reproducer!
                  Someone decades ago felt like storing unused tab bars for later re-usage in QMainWindowLayout.
                  Those were soft-leaked and taken care off, when QApplication got destroyed.
                  Reading the state back from settings causes the original tab bar (created in the C++ part) to become unused, but not removed from its QMainWindow parent. That ultimately lead to a double delete and the crash.
                  Let's see, if my thorough reviewers let me get away without writing an autotest ;-)

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  3
                  • l3u_L Offline
                    l3u_L Offline
                    l3u_
                    wrote last edited by
                    #22

                    Wow, that was fast :-) Thanks for the immediate fix! Nice to see my stuff helped here!

                    That was quite deep inside Qt apparently … where will this land? Qt 6.10.0? Or will it be backported?

                    I tried to cherry-pick it to a 6.9.1 checkout to test it, but it seems that's no trivial task …

                    jsulmJ 1 Reply Last reply
                    0
                    • l3u_L l3u_

                      Wow, that was fast :-) Thanks for the immediate fix! Nice to see my stuff helped here!

                      That was quite deep inside Qt apparently … where will this land? Qt 6.10.0? Or will it be backported?

                      I tried to cherry-pick it to a 6.9.1 checkout to test it, but it seems that's no trivial task …

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote last edited by
                      #23

                      @l3u_ You can see in the bug report:
                      Fix Version/s: 6.10.0 Beta2, 6.11.0 FF

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • l3u_L Offline
                        l3u_L Offline
                        l3u_
                        wrote last edited by l3u_
                        #24

                        Ah okay. So no 6.9 backport? I just wondered, because in the respective "Change ID" https://codereview.qt-project.org/c/qt/qtbase/+/653727, it's listed: "Fixes: QTBUG-137755 Pick-to: 6.10 6.9"

                        jsulmJ 1 Reply Last reply
                        0
                        • l3u_L l3u_

                          Ah okay. So no 6.9 backport? I just wondered, because in the respective "Change ID" https://codereview.qt-project.org/c/qt/qtbase/+/653727, it's listed: "Fixes: QTBUG-137755 Pick-to: 6.10 6.9"

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote last edited by
                          #25

                          @l3u_ Yes, it looks like it was cherry picked to 6.9 branch, so may end up in some 6.9.x version :-)

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • Axel SpoerlA Offline
                            Axel SpoerlA Offline
                            Axel Spoerl
                            Moderators
                            wrote last edited by
                            #26

                            The fix will land in 6.9.2, which we plan to release on August 14th.

                            If you want to cherry pick and compile locally, please make sure to pick the following 5 commits in the right order:

                            1. https://codereview.qt-project.org/c/qt/qtbase/+/653890
                            2. https://codereview.qt-project.org/c/qt/qtbase/+/653891
                            3. https://codereview.qt-project.org/c/qt/qtbase/+/653892
                            4. https://codereview.qt-project.org/c/qt/qtbase/+/653893
                            5. https://codereview.qt-project.org/c/qt/qtbase/+/653894

                            Software Engineer
                            The Qt Company, Oslo

                            1 Reply Last reply
                            3
                            • l3u_L Offline
                              l3u_L Offline
                              l3u_
                              wrote last edited by
                              #27

                              Nice :-)

                              I just tried it locally, cherry-picking the exact comments you linked. Worked without a collision on a v6.9.1 checkout.

                              And – you may already have thought that – I can confirm the segfault is gone now, also for my quite complex use-case :-)

                              1 Reply Last reply
                              3
                              • Axel SpoerlA Offline
                                Axel SpoerlA Offline
                                Axel Spoerl
                                Moderators
                                wrote last edited by
                                #28

                                Great that you are using dock widgets! As you may have suspected: QDockWidget is slightly closer to my heart than other creatures in the widget zoo ;-)

                                Software Engineer
                                The Qt Company, Oslo

                                S 1 Reply Last reply
                                1
                                • l3u_L Offline
                                  l3u_L Offline
                                  l3u_
                                  wrote last edited by
                                  #29

                                  First, it was just a QTabBar interface. But over the years, it got more and more complex, and at some point, I learned about QDockWidgets – and I loved them at first sight ;-) The same as the tab bar if you want – but way more if you need it. The possibility to arrange them as you like and need is really nice. This is actually a powerful tool, with a great user experience. QDockWidgets really rock! They do, from time to time, cause some headache (this is actually not the first bug I filed about them ;-) – but they are really cool.

                                  1 Reply Last reply
                                  2
                                  • Axel SpoerlA Offline
                                    Axel SpoerlA Offline
                                    Axel Spoerl
                                    Moderators
                                    wrote last edited by
                                    #30

                                    @l3u_
                                    Could you mark this thread as solved, please?

                                    Software Engineer
                                    The Qt Company, Oslo

                                    1 Reply Last reply
                                    0
                                    • Axel SpoerlA Axel Spoerl

                                      Great that you are using dock widgets! As you may have suspected: QDockWidget is slightly closer to my heart than other creatures in the widget zoo ;-)

                                      S Offline
                                      S Offline
                                      StudentScripter
                                      wrote last edited by
                                      #31

                                      @Axel-Spoerl Love QDockwidget too, great work <3

                                      I always miss them in QML ( i know that QML is mainly mobile focused but nevertheless). :D

                                      1 Reply Last reply
                                      1
                                      • Axel SpoerlA Offline
                                        Axel SpoerlA Offline
                                        Axel Spoerl
                                        Moderators
                                        wrote last edited by
                                        #32

                                        @StudentScripter Not as an immediate priority, but we are planning to implement something like dock widgets also in Quick Controls.

                                        Software Engineer
                                        The Qt Company, Oslo

                                        1 Reply Last reply
                                        0
                                        • l3u_L l3u_ has marked this topic as solved

                                        • Login

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