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. [Solved] Release mode crashing but not Debug mode?

[Solved] Release mode crashing but not Debug mode?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 12.9k 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.
  • CAD_codingC Offline
    CAD_codingC Offline
    CAD_coding
    wrote on last edited by
    #1

    Hi,
    I have a strange problem for my application.
    When I run the application from Qt Creator in Debug mode it is running fine.
    But when I run in Release mode it is crashing.
    Using qDebug() & a log file I know that it is completing the constructor of my Main Window class. After that when it goes into Qt's internal mechanism it is crashing. For about a second I am able to see Window with title bar & everything is white inside. Then it crashes.
    How do I know what is the cause of problem?
    And why is this only happening in Release mode?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Debug mode (not only in Qt, but in C++ in general) is less restrictive during runtime (it will allow you to go over reserved memory, it won't crash on some occasions etc.). So it indeed does sometimes happen that an app is running fine in debug, but bails out in release. What it means, however, is that you do have a bug in your code (dangling pointer, or perhaps an overflow in an array (using an index in QList that is greater than size(), for example)).

      (Z(:^

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nayar
        wrote on last edited by
        #3

        I'm having this issue. Totally ruins the point of "debugging" :-/

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          [quote author="Nayar" date="1389636196"]I'm having this issue. Totally ruins the point of "debugging" :-/[/quote]

          Only in some cases. And the fact that it happens should already point you in a right direction: you can be close to certain that you are doing something wrong with memory. Now just get a stack trace and try to guess where it failed :)

          (Z(:^

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nayar
            wrote on last edited by
            #5

            Managed to catch it :)

            But where to get the stack trace? I know it pops up when run in debugging mode. But mine was crashing in normal running only.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              On Linux, you can use strace. On Mac, you will get a stack trace every time: when the application crashes, Mac will try to send a report to Apple. You can take a look into it, it includes complete stack trace and a wealth of additional information. On Windows - sorry, I have no idea. But there has to be some tool available.

              (Z(:^

              1 Reply Last reply
              0
              • CAD_codingC Offline
                CAD_codingC Offline
                CAD_coding
                wrote on last edited by
                #7

                Yeah sometimes I feel like banging my laptop.
                But as usual Microsoft has let us developers down...

                1 Reply Last reply
                0
                • raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  [quote author="CAD_coding" date="1389667198"]Yeah sometimes I feel like banging my laptop.
                  But as usual Microsoft has let us developers down...[/quote]
                  It's not Microsoft's fault when you don't know the system very well from developers point of view...

                  See "this":http://msdn.microsoft.com/en-us/library/windows/hardware/ff542967(v=vs.85).aspx for example.

                  Also you can use QtCreator as post-mortem debugger on windows. Call this:
                  @
                  <QtCreatorDir>\bin\qtcdebugger -register
                  @

                  Make sure that your release binaries are built with debug-symbols. Using msvc compilers this would be *.pdb files.

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  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