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
QtWS25 Last Chance

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.1k 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.
  • 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
                  • S Offline
                    S Offline
                    snyang
                    wrote on last edited by
                    #23

                    I found one of my debug dll was compiled by using runtime library MultiThreadedDLL.
                    After change C/C++ -> runtime library as MultiThreadedDebugDLL in visual studio, the problem is gone.

                    Use the tool Dependencies, I can see the bad dll is using:

                    image.png

                    And the good dll is using:
                    f46e8deb-f487-4570-841d-ab9fbd8523d0-image.png

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      WaldemarH
                      wrote on last edited by
                      #24

                      Created a new project, build it and all was fine (the same code). And as stated above the reason was mixing of debug/non-debug libraries.
                      Now the whole issue as it looks occurred when that Project->Options->Advanced->Use Debug Libraries was set to No (in all VS versions I have never set this value to anything.. I assume it came with VS22). Which caused that Compiler->Code Generation->Runtime libraries switched to non-debug version in the background.

                      image.png

                      So the solution is to switch the 'Use Debug Libraries' to true and all will be ok.

                      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