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. Crash that occur only in debug mode with a simple project
Forum Updated to NodeBB v4.3 + New Features

Crash that occur only in debug mode with a simple project

Scheduled Pinned Locked Moved Solved General and Desktop
23 Posts 7 Posters 4.3k 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.
  • jsulmJ jsulm

    @embeddedmz Does FoobarManager have a parent? You could have a double delete.
    And this issue has absolutely nothing to do with QtCreator which is an IDE.

    D Offline
    D Offline
    deleted343
    wrote on last edited by
    #11

    @jsulm No it doesn't have a parent, and I'm competent enough to know these issues. It's an "empty" project, please take a look at it !

    Even if I do nothing in the destructor or I remove all delete statements everywhere it still crashes only with Qt Creator in debug mode.

    I still believe it's the fault of Qt Creator maybe it's using different DLLs or something like that or a compiling issue.

    jsulmJ J.HilkJ 2 Replies Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #12

      @embeddedmz said in Crash that occur only in debug mode with a simple project:

      It's an "empty" project, please take a look at it !

      Where? There is no minimal, compilable example somewhere...

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

      D 1 Reply Last reply
      0
      • D deleted343

        @jsulm No it doesn't have a parent, and I'm competent enough to know these issues. It's an "empty" project, please take a look at it !

        Even if I do nothing in the destructor or I remove all delete statements everywhere it still crashes only with Qt Creator in debug mode.

        I still believe it's the fault of Qt Creator maybe it's using different DLLs or something like that or a compiling issue.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by jsulm
        #13

        @embeddedmz What Qt version and compiler do you use?
        I just tested on Linux with Qt 5.12.8 and QtCreator 4.11.0 in debug mode and have no crashes.

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

        1 Reply Last reply
        0
        • D deleted343

          @KroMignon It's the PIMPL idiom and there's nothing wrong with the code, I used the same style many times on multiple platforms and the issue is not with the code but with the tool. I already put a breakpoint in the destructor and it's not called before the crash !

          Like I just said before, with Visual Studio 2019 and vcpkg there's no bugs ! Can you please clone the project and check that it's exiting properly ? Maybe my Qt Creator is mixing DLLs or something like that.

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #14

          @embeddedmz said in Crash that occur only in debug mode with a simple project:

          Like I just said before, with Visual Studio 2019 and vcpkg there's no bugs !

          Maybe, but are you sure m_Internals always have a valid value?
          Is it initialized to 0/nullptr when no used?
          Be aware with MSVC, MSVC is working differently between release/debug compilation. In debug, MSVC force uninitialized pointer to 0, this may mask some initialization issues!

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          0
          • D deleted343

            @jsulm No it doesn't have a parent, and I'm competent enough to know these issues. It's an "empty" project, please take a look at it !

            Even if I do nothing in the destructor or I remove all delete statements everywhere it still crashes only with Qt Creator in debug mode.

            I still believe it's the fault of Qt Creator maybe it's using different DLLs or something like that or a compiling issue.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #15

            @embeddedmz said in Crash that occur only in debug mode with a simple project:

            I still believe it's the fault of Qt Creator maybe it's using different DLLs or something like that or a compiling issue.

            Nope, works perfectly fine on MacOS ( Qt 5.15.2 & QtC 4.15.0)


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • jsulmJ jsulm

              @embeddedmz said in Crash that occur only in debug mode with a simple project:

              but with the tool

              How so? QtCreator is an IDE, nothing more. If there is an issue outside of your code then it is in Qt. But I doubt that. Different behaviour of release and debug builds is usually a sign for a bug in the code. And different compilers can behave differently in such situations.

              D Offline
              D Offline
              deleted343
              wrote on last edited by
              #16

              @jsulm said in Crash that occur only in debug mode with a simple project:

              How so? QtCreator is an IDE, nothing more. If there is an issue outside of your code then it is in Qt. But I doubt that. Different behaviour of release and debug builds is usually a sign for a bug in the code. And different compilers can behave differently in such situations.

              If your execution environement points to bad shared objects (DLLs in that case) your application can start and crash randomly during run time.

              I have to check the PATH folder or something like that but this stuff is usually handled automatically by Qt Creator when debugging. Using a dependency walker cannot help because in the output directory, Qt DLLs are not copied.

              1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @embeddedmz said in Crash that occur only in debug mode with a simple project:

                It's an "empty" project, please take a look at it !

                Where? There is no minimal, compilable example somewhere...

                D Offline
                D Offline
                deleted343
                wrote on last edited by
                #17

                @Christian-Ehrlicher I have already posted the link in the question : https://github.com/embeddedmz/QtCreatorDebugAppCrash

                JonBJ 1 Reply Last reply
                0
                • D deleted343

                  @Christian-Ehrlicher I have already posted the link in the question : https://github.com/embeddedmz/QtCreatorDebugAppCrash

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by JonB
                  #18

                  @embeddedmz
                  Does it not crash if you do put in Qt::QueuedConnection? You are connecting signal and slot while in one thread, so that will be direct connection, then moving one side into a thread. I do not know whether Qt adjusts the connection for you to become queued in this case, you need queued connections between different threads.

                  J.HilkJ D 2 Replies Last reply
                  0
                  • JonBJ JonB

                    @embeddedmz
                    Does it not crash if you do put in Qt::QueuedConnection? You are connecting signal and slot while in one thread, so that will be direct connection, then moving one side into a thread. I do not know whether Qt adjusts the connection for you to become queued in this case, you need queued connections between different threads.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by J.Hilk
                    #19

                    @JonB If its on Qt::AutoConnection (the default, when not specified) then it should "look that up during runtime", IIRC. And adjust accordingly

                    I would do without the raw delete and rather use deleteLater(), some Qt internals do not clean up properly/play nicely when you call the raw delete on QObjects


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    2
                    • JonBJ JonB

                      @embeddedmz
                      Does it not crash if you do put in Qt::QueuedConnection? You are connecting signal and slot while in one thread, so that will be direct connection, then moving one side into a thread. I do not know whether Qt adjusts the connection for you to become queued in this case, you need queued connections between different threads.

                      D Offline
                      D Offline
                      deleted343
                      wrote on last edited by deleted343
                      #20

                      @JonB I still have the same problem.

                      I'm sure it's Qt Creator using some bad DLLs in debug mode but I don't know how to check that and how to fix it.

                      JonBJ 1 Reply Last reply
                      0
                      • D deleted343

                        @JonB I still have the same problem.

                        I'm sure it's Qt Creator using some bad DLLs in debug mode but I don't know how to check that and how to fix it.

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #21

                        @embeddedmz
                        Looking at your stack trace, what is the QtVisualStudioDebuggerBug file for which you do not have the source? That name looks a little bit worrying?

                        1 Reply Last reply
                        1
                        • D Offline
                          D Offline
                          deleted343
                          wrote on last edited by
                          #22

                          Now, I can't even build after updating VS2019 :

                          D:\DevProjects\QtVisualStudioDebuggerBug\CMakeLists.txt:3: erreur : No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

                          Any insights on how to fix this ?

                          Thanks.

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            deleted343
                            wrote on last edited by deleted343
                            #23

                            I reinstalled Qt, the issue disappeared but now I'm having the commercial version of Qt ??!!?? Fixed this last issue by creating a new Qt account. Please Qt Company, fix your installer.

                            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