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. Why does a program that runs properly in debug mode crash in release mode?
Forum Updated to NodeBB v4.3 + New Features

Why does a program that runs properly in debug mode crash in release mode?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 5 Posters 614 Views 2 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.
  • D Offline
    D Offline
    duncan98
    wrote on last edited by duncan98
    #1

    hi,Why does a program that runs properly in debug mode crash in release mode?

    J.HilkJ CP71C 2 Replies Last reply
    0
    • D duncan98

      hi,Why does a program that runs properly in debug mode crash in release mode?

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

      @duncan98
      99% chance, its missing initialisation


      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
      5
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        This is not a Qt problem. Many reasons. The first thing I would do is to check the code to see if there is something like
        #If DEBUG
        bla bla
        #endif
        which may be needed for release as well.
        Run cppcheck to check your code to see if there is any issue.
        Or
        strace your app to check where the problem shows up.

        1 Reply Last reply
        0
        • D duncan98

          hi,Why does a program that runs properly in debug mode crash in release mode?

          CP71C Offline
          CP71C Offline
          CP71
          wrote on last edited by
          #4

          @duncan98
          Hi
          When I see this behavior, I immediately think of a variable that is not set (without default value).

          As someone has advised us you can try
          https://github.com/asmaloney/asmCrashReport

          1 Reply Last reply
          2
          • D Offline
            D Offline
            duncan98
            wrote on last edited by
            #5

            error.JPG
            Is this a null pointer exception?

            CP71C 2 Replies Last reply
            0
            • D duncan98

              error.JPG
              Is this a null pointer exception?

              CP71C Offline
              CP71C Offline
              CP71
              wrote on last edited by CP71
              #6

              @duncan98
              Yep, it is possible!
              https://en.wikipedia.org/wiki/Segmentation_fault

              As first step try to check your pointers

              1 Reply Last reply
              0
              • D duncan98

                error.JPG
                Is this a null pointer exception?

                CP71C Offline
                CP71C Offline
                CP71
                wrote on last edited by
                #7

                @duncan98
                Null pointer or invalid pointer (random value of pointer)!

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mchinand
                  wrote on last edited by
                  #8

                  You may be able to debug this issue by using a ReleaseWithDebInfo configuration if you are using CMake or add the following to your .pro file if you are still using qmake (and build in Release mode). Then run it in the debugger within QtCreator. If it's an uninitialized pointer, it should show you on what line an uninitialized object is trying to be dereferenced.

                  CONFIG += force_debug_info
                  
                  D 1 Reply Last reply
                  3
                  • M mchinand

                    You may be able to debug this issue by using a ReleaseWithDebInfo configuration if you are using CMake or add the following to your .pro file if you are still using qmake (and build in Release mode). Then run it in the debugger within QtCreator. If it's an uninitialized pointer, it should show you on what line an uninitialized object is trying to be dereferenced.

                    CONFIG += force_debug_info
                    
                    D Offline
                    D Offline
                    duncan98
                    wrote on last edited by
                    #9

                    hi, @mchinand
                    My compiler shows mingw8.1, and the editor is unable to debug breakpoint information in release mode.
                    The CONFIG + = force_debug_info,
                    This has no effect on the configuration file

                    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