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. My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows

My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 8 Posters 2.2k Views
  • 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.
  • N Offline
    N Offline
    Nelson numerical software
    wrote on 25 Oct 2023, 07:01 last edited by
    #1

    Hi,

    Here https://github.com/Nelson-numerical-software/nelson
    this project already build with Qt 5.x and Qt6.x without troubles on Windows x64

    I try to use new version Qt 6.6.0, it works with a release build (my code in release with qt 6.6.0 release)
    But it crashs when I try to build in debug mode (my code in debug with Qt6.6.0 release)
    28be125c-1c8f-412f-8c93-613b752aff72-image.png

    Have I missed something with the new Qt 6.6.0 release regarding debugging or is this a bug?

    official qt.io version 6.6.0 with up to date msvc 2022 compiler

    J 1 Reply Last reply 25 Oct 2023, 07:03
    0
    • N Nelson numerical software
      25 Oct 2023, 07:01

      Hi,

      Here https://github.com/Nelson-numerical-software/nelson
      this project already build with Qt 5.x and Qt6.x without troubles on Windows x64

      I try to use new version Qt 6.6.0, it works with a release build (my code in release with qt 6.6.0 release)
      But it crashs when I try to build in debug mode (my code in debug with Qt6.6.0 release)
      28be125c-1c8f-412f-8c93-613b752aff72-image.png

      Have I missed something with the new Qt 6.6.0 release regarding debugging or is this a bug?

      official qt.io version 6.6.0 with up to date msvc 2022 compiler

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 25 Oct 2023, 07:03 last edited by
      #2

      @Nelson-numerical-software Please post stack trace after the crash

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

      N 1 Reply Last reply 25 Oct 2023, 07:19
      1
      • J jsulm
        25 Oct 2023, 07:03

        @Nelson-numerical-software Please post stack trace after the crash

        N Offline
        N Offline
        Nelson numerical software
        wrote on 25 Oct 2023, 07:19 last edited by
        #3

        @jsulm

        Here 3 stack traces (calling embedded editor, doc or plot using Qt)

        59c7b534-244b-4c2f-a85d-c9ea4a328f94-image.png

        83ea5c8f-e95d-4bc5-865f-fcd50d2aa98d-image.png

        92ad308f-5564-4f30-bd90-c2eb2a1b0ec2-image.png

        J 1 Reply Last reply 25 Oct 2023, 07:22
        0
        • N Nelson numerical software
          25 Oct 2023, 07:19

          @jsulm

          Here 3 stack traces (calling embedded editor, doc or plot using Qt)

          59c7b534-244b-4c2f-a85d-c9ea4a328f94-image.png

          83ea5c8f-e95d-4bc5-865f-fcd50d2aa98d-image.png

          92ad308f-5564-4f30-bd90-c2eb2a1b0ec2-image.png

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 25 Oct 2023, 07:22 last edited by
          #4

          @Nelson-numerical-software So, what are you doing in Highlighter constrcutor (post its code)?

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

          N 1 Reply Last reply 25 Oct 2023, 07:33
          0
          • J jsulm
            25 Oct 2023, 07:22

            @Nelson-numerical-software So, what are you doing in Highlighter constrcutor (post its code)?

            N Offline
            N Offline
            Nelson numerical software
            wrote on 25 Oct 2023, 07:33 last edited by
            #5

            @jsulm

            https://github.com/Nelson-numerical-software/nelson/blob/master/modules/text_editor/src/cpp/QtHighlighter.cpp

            C N 2 Replies Last reply 25 Oct 2023, 07:36
            0
            • N Nelson numerical software
              25 Oct 2023, 07:33

              @jsulm

              https://github.com/Nelson-numerical-software/nelson/blob/master/modules/text_editor/src/cpp/QtHighlighter.cpp

              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 25 Oct 2023, 07:36 last edited by
              #6

              Do you access this from different threads without proper locking?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              N 1 Reply Last reply 25 Oct 2023, 08:06
              1
              • N Nelson numerical software
                25 Oct 2023, 07:33

                @jsulm

                https://github.com/Nelson-numerical-software/nelson/blob/master/modules/text_editor/src/cpp/QtHighlighter.cpp

                N Offline
                N Offline
                Nelson numerical software
                wrote on 25 Oct 2023, 07:52 last edited by
                #7

                06cdfbb5-223c-45ca-87ef-8406b051325b-image.png

                1 Reply Last reply
                0
                • C Christian Ehrlicher
                  25 Oct 2023, 07:36

                  Do you access this from different threads without proper locking?

                  N Offline
                  N Offline
                  Nelson numerical software
                  wrote on 25 Oct 2023, 08:06 last edited by
                  #8

                  @Christian-Ehrlicher

                  one thread for gui
                  one thread for algo.

                  Same code with qt6.5 in debug mode (with qt release mode) on windows does not crash.

                  I will try with debug version of qt6.6 if I have same behavior.

                  J 1 Reply Last reply 25 Oct 2023, 08:07
                  0
                  • N Nelson numerical software
                    25 Oct 2023, 08:06

                    @Christian-Ehrlicher

                    one thread for gui
                    one thread for algo.

                    Same code with qt6.5 in debug mode (with qt release mode) on windows does not crash.

                    I will try with debug version of qt6.6 if I have same behavior.

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 25 Oct 2023, 08:07 last edited by jsulm
                    #9

                    @Nelson-numerical-software said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:

                    one thread for gui
                    one thread for algo.

                    So, do you manipulate UI from the algo thread or not? This is not supported and can lead to crashes.
                    And please post code as text not pictures.

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

                    N 1 Reply Last reply 25 Oct 2023, 08:29
                    1
                    • J jsulm
                      25 Oct 2023, 08:07

                      @Nelson-numerical-software said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:

                      one thread for gui
                      one thread for algo.

                      So, do you manipulate UI from the algo thread or not? This is not supported and can lead to crashes.
                      And please post code as text not pictures.

                      N Offline
                      N Offline
                      Nelson numerical software
                      wrote on 25 Oct 2023, 08:29 last edited by
                      #10

                      @jsulm

                      current examples with crash are simple call to gui feature.
                      I do not manipulate ui from algo.
                      In release mode, it works with qt6.6.0 but not in debug
                      same code also works in Qt6.5.0 in debug mode.

                      00007ffa467acb2c()
                      00007ffa467b0275()
                      00007ffa467b0988()
                      QArrayDataPointer<QString>::~QArrayDataPointer<QString>()
                      [Code externe]
                      Nelson::HelpCollection::getRegisteredFiles()
                      Nelson::HelpBrowser::getAttributes()
                      Nelson::HelpBrowserGateway::helpbrowserBuiltin(int, const Nelson::ListVector<Nelson::ArrayOf> &)
                      Nelson::EvaluateBuiltinCatchRuntimeException(Nelson::Evaluator *, void *, const Nelson::ListVector<Nelson::ArrayOf> &, int, unsigned __int64, bool)
                      

                      Please also notice that if I comment in QArrayDataPointer
                      (Qt\6.6.0\msvc2019_64\include\QtCore\qarraydatapointer.h)
                      line 104 free(d)

                      It works in debug mode

                      a418644d-47f0-4181-a195-9c76c1d7fb69-image.png

                      JonBJ 1 Reply Last reply 25 Oct 2023, 08:42
                      0
                      • N Nelson numerical software
                        25 Oct 2023, 08:29

                        @jsulm

                        current examples with crash are simple call to gui feature.
                        I do not manipulate ui from algo.
                        In release mode, it works with qt6.6.0 but not in debug
                        same code also works in Qt6.5.0 in debug mode.

                        00007ffa467acb2c()
                        00007ffa467b0275()
                        00007ffa467b0988()
                        QArrayDataPointer<QString>::~QArrayDataPointer<QString>()
                        [Code externe]
                        Nelson::HelpCollection::getRegisteredFiles()
                        Nelson::HelpBrowser::getAttributes()
                        Nelson::HelpBrowserGateway::helpbrowserBuiltin(int, const Nelson::ListVector<Nelson::ArrayOf> &)
                        Nelson::EvaluateBuiltinCatchRuntimeException(Nelson::Evaluator *, void *, const Nelson::ListVector<Nelson::ArrayOf> &, int, unsigned __int64, bool)
                        

                        Please also notice that if I comment in QArrayDataPointer
                        (Qt\6.6.0\msvc2019_64\include\QtCore\qarraydatapointer.h)
                        line 104 free(d)

                        It works in debug mode

                        a418644d-47f0-4181-a195-9c76c1d7fb69-image.png

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on 25 Oct 2023, 08:42 last edited by JonB
                        #11

                        @Nelson-numerical-software
                        Just because something does work in different versions of Qt or between release and debug mode does not mean that code is correct. Bugs show up (or don't show up) under many different circumstances.

                        I would start by concentrating on the question about whether you may be accessing the UI from a secondary thread. We have seen this countless times in people's code, even when they claim not to be doing so. Try your code without threads? Produce some minimal example which illustrates the crash?

                        N 1 Reply Last reply 25 Oct 2023, 09:00
                        1
                        • JonBJ JonB
                          25 Oct 2023, 08:42

                          @Nelson-numerical-software
                          Just because something does work in different versions of Qt or between release and debug mode does not mean that code is correct. Bugs show up (or don't show up) under many different circumstances.

                          I would start by concentrating on the question about whether you may be accessing the UI from a secondary thread. We have seen this countless times in people's code, even when they claim not to be doing so. Try your code without threads? Produce some minimal example which illustrates the crash?

                          N Offline
                          N Offline
                          Nelson numerical software
                          wrote on 25 Oct 2023, 09:00 last edited by
                          #12

                          @JonB

                          Sure ;)

                          When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p

                          Anyway it was not a complaint. It was just that I constated Qt6.2, 6.5 works in these cases and not 6.6.0

                          I will survey the class QArrayDataPointer and previous tickets fixed in Qt6.6.0 about it.

                          Thanks for your help

                          C JonBJ 2 Replies Last reply 25 Oct 2023, 09:04
                          0
                          • N Nelson numerical software
                            25 Oct 2023, 09:00

                            @JonB

                            Sure ;)

                            When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p

                            Anyway it was not a complaint. It was just that I constated Qt6.2, 6.5 works in these cases and not 6.6.0

                            I will survey the class QArrayDataPointer and previous tickets fixed in Qt6.6.0 about it.

                            Thanks for your help

                            C Offline
                            C Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on 25 Oct 2023, 09:04 last edited by
                            #13

                            QArrayDataPointer is a fundamental piece of a lot of basic qt classes. I doubt you found a bug in there. You do something wrong with your threading.

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            1 Reply Last reply
                            2
                            • N Nelson numerical software
                              25 Oct 2023, 09:00

                              @JonB

                              Sure ;)

                              When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p

                              Anyway it was not a complaint. It was just that I constated Qt6.2, 6.5 works in these cases and not 6.6.0

                              I will survey the class QArrayDataPointer and previous tickets fixed in Qt6.6.0 about it.

                              Thanks for your help

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on 25 Oct 2023, 09:06 last edited by JonB
                              #14

                              @Nelson-numerical-software said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:

                              When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p

                              That is true if your code is correct. However, if your code has some "fault" which has not shown up before and happens to go wrong now with a change of environment this happens. And it is the case that where a threading issue is involved you never know what changed circumstances may make it appear. It is the same with any code, nothing to do with Qt.

                              N 1 Reply Last reply 25 Oct 2023, 09:33
                              0
                              • JonBJ JonB
                                25 Oct 2023, 09:06

                                @Nelson-numerical-software said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:

                                When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p

                                That is true if your code is correct. However, if your code has some "fault" which has not shown up before and happens to go wrong now with a change of environment this happens. And it is the case that where a threading issue is involved you never know what changed circumstances may make it appear. It is the same with any code, nothing to do with Qt.

                                N Offline
                                N Offline
                                Nelson numerical software
                                wrote on 25 Oct 2023, 09:33 last edited by
                                #15

                                Thank you for these comprehensive comments. :)

                                Great work from the developers for this 6.6.0 with many new features.

                                I have my answer

                                C 1 Reply Last reply 25 Oct 2023, 10:28
                                0
                                • N Nelson numerical software has marked this topic as solved on 25 Oct 2023, 09:35
                                • N Nelson numerical software
                                  25 Oct 2023, 09:33

                                  Thank you for these comprehensive comments. :)

                                  Great work from the developers for this 6.6.0 with many new features.

                                  I have my answer

                                  C Offline
                                  C Offline
                                  Christian Ehrlicher
                                  Lifetime Qt Champion
                                  wrote on 25 Oct 2023, 10:28 last edited by
                                  #16

                                  Your pragma(lib) stuff in dllmain.cpp is wrong. You must not mix debug and release libraries on windows. I would remove this MSVC only stuff and let do cmake the correct things.

                                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                  Visit the Qt Academy at https://academy.qt.io/catalog

                                  N 1 Reply Last reply 29 Apr 2024, 12:32
                                  4
                                  • H human99 referenced this topic on 15 Dec 2023, 23:53
                                  • C Christian Ehrlicher
                                    25 Oct 2023, 10:28

                                    Your pragma(lib) stuff in dllmain.cpp is wrong. You must not mix debug and release libraries on windows. I would remove this MSVC only stuff and let do cmake the correct things.

                                    N Offline
                                    N Offline
                                    Nelson numerical software
                                    wrote on 29 Apr 2024, 12:32 last edited by
                                    #17

                                    @Christian-Ehrlicher said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:

                                    Your pragma(lib) stuff in dllmain.cpp is wrong. You must not mix debug and release libraries on windows. I would remove this MSVC only stuff and let do cmake the correct things.

                                    I confirm that it was the trouble

                                    on windows debug build must be linked with Qt debug library

                                    Thanks for your time and investigations

                                    1 Reply Last reply
                                    0
                                    • O Offline
                                      O Offline
                                      OnkarP
                                      wrote on 14 Jun 2024, 04:40 last edited by
                                      #18

                                      Can you explain what you changed to fix this issue ?
                                      As I am also facing the similar problem. I am using already built MSVC 2019 64 bit compiled libraries from QT 6.6.3 with VS 2022 C++ 64 bit application. My application is wrote for Debug and Release configuration. In both modes the crash is happening.

                                      1 Reply Last reply
                                      0
                                      • K Offline
                                        K Offline
                                        KeithS
                                        wrote on 7 Aug 2024, 12:32 last edited by
                                        #19

                                        Thanks @Nelson-numerical-software I had the exact same problem too. Easy mistake to make in Visual C++ when updating Qt versions and modifying linker input file list.

                                        C 1 Reply Last reply 7 Aug 2024, 12:33
                                        0
                                        • K KeithS
                                          7 Aug 2024, 12:32

                                          Thanks @Nelson-numerical-software I had the exact same problem too. Easy mistake to make in Visual C++ when updating Qt versions and modifying linker input file list.

                                          C Offline
                                          C Offline
                                          Christian Ehrlicher
                                          Lifetime Qt Champion
                                          wrote on 7 Aug 2024, 12:33 last edited by
                                          #20

                                          @KeithS said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:

                                          and modifying linker input file list.

                                          That's the reason to use a build system like e.g. CMake.

                                          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                          Visit the Qt Academy at https://academy.qt.io/catalog

                                          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