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. Qt 6.6.0 Destructor of QList causes a crash.
QtWS25 Last Chance

Qt 6.6.0 Destructor of QList causes a crash.

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 3 Posters 2.0k 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.
  • H Offline
    H Offline
    human99
    wrote on 16 Dec 2023, 09:48 last edited by
    #5

    @Christian-Ehrlicher What do you mean mixing debug and release libs? As in, I'm linking with Qt libs compiled for debug/release at the same time?

    If that's the case I've only ever compiled Qt6 once for Release x64.

    J 1 Reply Last reply 16 Dec 2023, 09:56
    0
    • H human99
      16 Dec 2023, 09:48

      @Christian-Ehrlicher What do you mean mixing debug and release libs? As in, I'm linking with Qt libs compiled for debug/release at the same time?

      If that's the case I've only ever compiled Qt6 once for Release x64.

      J Online
      J Online
      JonB
      wrote on 16 Dec 2023, 09:56 last edited by
      #6

      @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

      If that's the case I've only ever compiled Qt6 once for Release x64.

      Then you must not build your own application for Debug, as you say you have. Everything --- your application and any libraries it uses, including Qt --- must all be compiled for only one of Debug or Release. You would need to compile your Qt6 for Debug if you want to do the same for your program

      I believe MSVC/Windows runtime C++ libraries make it so it is possible to mix these during a compilation/link, and if so that causes such problems as you say, weird crashes.

      H 2 Replies Last reply 16 Dec 2023, 10:28
      1
      • J JonB
        16 Dec 2023, 09:56

        @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

        If that's the case I've only ever compiled Qt6 once for Release x64.

        Then you must not build your own application for Debug, as you say you have. Everything --- your application and any libraries it uses, including Qt --- must all be compiled for only one of Debug or Release. You would need to compile your Qt6 for Debug if you want to do the same for your program

        I believe MSVC/Windows runtime C++ libraries make it so it is possible to mix these during a compilation/link, and if so that causes such problems as you say, weird crashes.

        H Offline
        H Offline
        human99
        wrote on 16 Dec 2023, 10:28 last edited by
        #7

        @JonB
        Thank you very much for the answer, I had no idea that was the case.

        So my by mixing debug and release what is meant is literally don't build your own application in debug with Qt release libs or vice versa.

        J 1 Reply Last reply 16 Dec 2023, 10:42
        0
        • J JonB
          16 Dec 2023, 09:56

          @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

          If that's the case I've only ever compiled Qt6 once for Release x64.

          Then you must not build your own application for Debug, as you say you have. Everything --- your application and any libraries it uses, including Qt --- must all be compiled for only one of Debug or Release. You would need to compile your Qt6 for Debug if you want to do the same for your program

          I believe MSVC/Windows runtime C++ libraries make it so it is possible to mix these during a compilation/link, and if so that causes such problems as you say, weird crashes.

          H Offline
          H Offline
          human99
          wrote on 16 Dec 2023, 10:41 last edited by
          #8

          @JonB Or I suppose more generally, this isn't QT specific information: Everything must be compiled for the same 'platform'

          1 Reply Last reply
          0
          • H human99
            16 Dec 2023, 10:28

            @JonB
            Thank you very much for the answer, I had no idea that was the case.

            So my by mixing debug and release what is meant is literally don't build your own application in debug with Qt release libs or vice versa.

            J Online
            J Online
            JonB
            wrote on 16 Dec 2023, 10:42 last edited by JonB
            #9

            @human99
            Exactly that. I don't quite know how in your situation all the stuff successfully links when some is debug-only and some is release-only, I don't know if that is something MSVC permits, but it doesn't sound good. All of one kind or another, then see if your bug occurs.

            H 2 Replies Last reply 16 Dec 2023, 10:55
            1
            • J JonB
              16 Dec 2023, 10:42

              @human99
              Exactly that. I don't quite know how in your situation all the stuff successfully links when some is debug-only and some is release-only, I don't know if that is something MSVC permits, but it doesn't sound good. All of one kind or another, then see if your bug occurs.

              H Offline
              H Offline
              human99
              wrote on 16 Dec 2023, 10:55 last edited by
              #10

              @JonB
              Thank you very much for the info. I built the app for release and it works perfectly fine. As you could tell I'm a bit new to system's languages so I never knew about this.

              May I ask how do you automate this with CMake?

              I've compiled QT for x64 Release and installed it in C:\qt6. I imagine if I wanted to build my app for debug I'd need to recompile QT for x64 debug and install it where?

              I can install it in some other arbitrary path and figure out how to manually get this working but is there any sensible way to install it such that a CMake flag would automatically build with the appropriate qt version?

              J C 2 Replies Last reply 16 Dec 2023, 10:59
              0
              • H human99
                16 Dec 2023, 10:55

                @JonB
                Thank you very much for the info. I built the app for release and it works perfectly fine. As you could tell I'm a bit new to system's languages so I never knew about this.

                May I ask how do you automate this with CMake?

                I've compiled QT for x64 Release and installed it in C:\qt6. I imagine if I wanted to build my app for debug I'd need to recompile QT for x64 debug and install it where?

                I can install it in some other arbitrary path and figure out how to manually get this working but is there any sensible way to install it such that a CMake flag would automatically build with the appropriate qt version?

                J Online
                J Online
                JonB
                wrote on 16 Dec 2023, 10:59 last edited by
                #11

                @human99 I don't build Qt, use CMake or run on Windows. You will want to build Qt for both Debug & Release, but you'll have to wait for someone else to answer.

                1 Reply Last reply
                1
                • J JonB
                  16 Dec 2023, 10:42

                  @human99
                  Exactly that. I don't quite know how in your situation all the stuff successfully links when some is debug-only and some is release-only, I don't know if that is something MSVC permits, but it doesn't sound good. All of one kind or another, then see if your bug occurs.

                  H Offline
                  H Offline
                  human99
                  wrote on 16 Dec 2023, 13:40 last edited by
                  #12

                  @JonB Yeah you're right there's some funky business going on since now that I built the debug version all the .dlls and .libs names end with a d to differenciate them from their release counterparts.

                  Why my debug build before was linking to release libraries is beyond me. Then again I am calling cmake through visual studio so I can imagine something being caused by that.

                  1 Reply Last reply
                  0
                  • H human99
                    16 Dec 2023, 10:55

                    @JonB
                    Thank you very much for the info. I built the app for release and it works perfectly fine. As you could tell I'm a bit new to system's languages so I never knew about this.

                    May I ask how do you automate this with CMake?

                    I've compiled QT for x64 Release and installed it in C:\qt6. I imagine if I wanted to build my app for debug I'd need to recompile QT for x64 debug and install it where?

                    I can install it in some other arbitrary path and figure out how to manually get this working but is there any sensible way to install it such that a CMake flag would automatically build with the appropriate qt version?

                    C Offline
                    C Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 16 Dec 2023, 14:10 last edited by
                    #13

                    @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

                    I'd need to recompile QT for x64 debug and install it where?

                    In the same place.

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

                    H 1 Reply Last reply 16 Dec 2023, 22:23
                    0
                    • C Christian Ehrlicher
                      16 Dec 2023, 14:10

                      @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

                      I'd need to recompile QT for x64 debug and install it where?

                      In the same place.

                      H Offline
                      H Offline
                      human99
                      wrote on 16 Dec 2023, 22:23 last edited by
                      #14

                      @Christian-Ehrlicher
                      I'm compiling on windows so do you mean that when I use configure.bat I provide the same folder as an argument to the
                      -prefix flag. And build twice, once for debug, once for release and install them to the same directory?

                      I've also seen the -debug-and-release option for configure.bat which seems like it was made for this but unfortunately I'm getting an error when using that flag.

                      C 1 Reply Last reply 17 Dec 2023, 06:57
                      0
                      • H human99
                        16 Dec 2023, 22:23

                        @Christian-Ehrlicher
                        I'm compiling on windows so do you mean that when I use configure.bat I provide the same folder as an argument to the
                        -prefix flag. And build twice, once for debug, once for release and install them to the same directory?

                        I've also seen the -debug-and-release option for configure.bat which seems like it was made for this but unfortunately I'm getting an error when using that flag.

                        C Offline
                        C Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 17 Dec 2023, 06:57 last edited by
                        #15

                        @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

                        And build twice, once for debug, once for release and install them to the same directory?

                        In the same place.

                        What else should this mean?

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

                        H 1 Reply Last reply 17 Dec 2023, 11:40
                        0
                        • C Christian Ehrlicher
                          17 Dec 2023, 06:57

                          @human99 said in Qt 6.6.0 Destructor of QList causes a crash.:

                          And build twice, once for debug, once for release and install them to the same directory?

                          In the same place.

                          What else should this mean?

                          H Offline
                          H Offline
                          human99
                          wrote on 17 Dec 2023, 11:40 last edited by
                          #16

                          @Christian-Ehrlicher

                          From the point of view of a beginner that's not familiar with building code it's unintuitive. I assumed the install directory would need to be empty. Thank you very much for the input, both of you solved my problem.

                          C 1 Reply Last reply 17 Dec 2023, 12:36
                          0
                          • H human99 has marked this topic as solved on 17 Dec 2023, 11:41
                          • H human99
                            17 Dec 2023, 11:40

                            @Christian-Ehrlicher

                            From the point of view of a beginner that's not familiar with building code it's unintuitive. I assumed the install directory would need to be empty. Thank you very much for the input, both of you solved my problem.

                            C Offline
                            C Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on 17 Dec 2023, 12:36 last edited by
                            #17

                            @human99 When you follow https://doc.qt.io/qt-6/windows-building.html then debug and release is built in one step. When you followed it and did only get the release libs then it's a bug on Qt side. Otherwise you did something different without known what to do.

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

                            H 1 Reply Last reply 17 Dec 2023, 15:15
                            1
                            • C Christian Ehrlicher
                              17 Dec 2023, 12:36

                              @human99 When you follow https://doc.qt.io/qt-6/windows-building.html then debug and release is built in one step. When you followed it and did only get the release libs then it's a bug on Qt side. Otherwise you did something different without known what to do.

                              H Offline
                              H Offline
                              human99
                              wrote on 17 Dec 2023, 15:15 last edited by
                              #18

                              @Christian-Ehrlicher Thanks for the extra info. I followed https://wiki.qt.io/Building_Qt_6_from_Git, and looking at the link you provided, it outlines the same steps. The only difference being that the link I followed also shows how to get the sources from the qt git repo.

                              I don't know if it's a bug on QT's side, I suppose it would be if the build's default behaviour should be to build both debug and release libraries.

                              To be specific: After I ran configure.bat, the batch script's output to the commandline outlines your build options:

                              Build options:
                              Mode ................................... release
                              ...
                              

                              And in my case the mode was set to release. And as a sanity check looking in the install folder, the names of all of the .dlls and .lib files do not end with d, so they're definitely the release binary files.

                              There is a flag you could pass to configure.bat called -debug-and-release that changes this behaviour. Results in a build error for me, but that's another topic. Building twice, once with -release, and once with -debug separately work flawlessly however.

                              I used configure.bat as shown in the links, I didn't manually change the target output of the build.

                              C 1 Reply Last reply 17 Dec 2023, 17:54
                              1
                              • H human99
                                17 Dec 2023, 15:15

                                @Christian-Ehrlicher Thanks for the extra info. I followed https://wiki.qt.io/Building_Qt_6_from_Git, and looking at the link you provided, it outlines the same steps. The only difference being that the link I followed also shows how to get the sources from the qt git repo.

                                I don't know if it's a bug on QT's side, I suppose it would be if the build's default behaviour should be to build both debug and release libraries.

                                To be specific: After I ran configure.bat, the batch script's output to the commandline outlines your build options:

                                Build options:
                                Mode ................................... release
                                ...
                                

                                And in my case the mode was set to release. And as a sanity check looking in the install folder, the names of all of the .dlls and .lib files do not end with d, so they're definitely the release binary files.

                                There is a flag you could pass to configure.bat called -debug-and-release that changes this behaviour. Results in a build error for me, but that's another topic. Building twice, once with -release, and once with -debug separately work flawlessly however.

                                I used configure.bat as shown in the links, I didn't manually change the target output of the build.

                                C Offline
                                C Offline
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on 17 Dec 2023, 17:54 last edited by
                                #19

                                @human99 Ok, thx for the investigation. I'll take a look on it - it should default to debug-and-release to avoid the problems you've encountered.

                                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

                                14/19

                                16 Dec 2023, 22:23

                                • Login

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