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
Forum Updated to NodeBB v4.3 + New Features

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.3k Views 1 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.
  • jsulmJ jsulm

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

    N Offline
    N Offline
    Nelson numerical software
    wrote on 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

    jsulmJ 1 Reply Last reply
    0
    • N Nelson numerical software

      @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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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
      0
      • jsulmJ jsulm

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

        N Offline
        N Offline
        Nelson numerical software
        wrote on last edited by
        #5

        @jsulm

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

        Christian EhrlicherC N 2 Replies Last reply
        0
        • N Nelson numerical software

          @jsulm

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

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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
          1
          • N Nelson numerical software

            @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 last edited by
            #7

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

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              Do you access this from different threads without proper locking?

              N Offline
              N Offline
              Nelson numerical software
              wrote on 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.

              jsulmJ 1 Reply Last reply
              0
              • N Nelson numerical software

                @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.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on 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
                1
                • jsulmJ jsulm

                  @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 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
                  0
                  • N Nelson numerical software

                    @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 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
                    1
                    • JonBJ JonB

                      @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 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

                      Christian EhrlicherC JonBJ 2 Replies Last reply
                      0
                      • N Nelson numerical software

                        @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

                        Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 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

                          @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 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
                          0
                          • JonBJ JonB

                            @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 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

                            Christian EhrlicherC 1 Reply Last reply
                            0
                            • N Nelson numerical software has marked this topic as solved on
                            • N Nelson numerical software

                              Thank you for these comprehensive comments. :)

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

                              I have my answer

                              Christian EhrlicherC Offline
                              Christian EhrlicherC Offline
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on 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
                              4
                              • H human99 referenced this topic on
                              • Christian EhrlicherC Christian Ehrlicher

                                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 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 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 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.

                                    Christian EhrlicherC 1 Reply Last reply
                                    0
                                    • K KeithS

                                      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.

                                      Christian EhrlicherC Offline
                                      Christian EhrlicherC Offline
                                      Christian Ehrlicher
                                      Lifetime Qt Champion
                                      wrote on 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
                                      • W Offline
                                        W Offline
                                        WaldemarH
                                        wrote on last edited by
                                        #21

                                        Hi guys. I just came to the same issue on 6.8.2 where even the code below crashes on exactly the same space as above where the code run perfect before. So what changed... the build was done on w10 (months ago) and then after a format w11 was installed with a clean VS2022 installation. Since this happened qt crashes all the time. Now project didn't change so w10->w11 transition has to be the culprit. I'll edit this post after I'll rebuild 6.8.2 on w11.

                                        int main( int argc, char *argv[] )
                                        {
                                        QVector<JSON_Object> value_object_list;

                                        JSON_Object		e1;
                                        JSON_Object		e2;
                                        JSON_Object		e3;
                                        JSON_Object		e4;
                                        JSON_Object		e5;
                                        
                                        value_object_list.append( e1 );
                                        value_object_list.append( e2 );
                                        value_object_list.append( e3 );
                                        value_object_list.append( e4 );
                                        value_object_list.append( e5 );
                                        
                                        1 Reply Last reply
                                        1
                                        • Christian EhrlicherC Offline
                                          Christian EhrlicherC Offline
                                          Christian Ehrlicher
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #22

                                          Don't mix debug and release libraries.

                                          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
                                          1

                                          • Login

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