Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved] Release mode crashing but not Debug mode?

    General and Desktop
    4
    8
    12063
    Loading More Posts
    • 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_coding
      CAD_coding last edited by

      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 Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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 Reply Quote 0
        • N
          Nayar last edited by

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

          1 Reply Last reply Reply Quote 0
          • sierdzio
            sierdzio Moderators last edited by

            [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 Reply Quote 0
            • N
              Nayar last edited by

              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 Reply Quote 0
              • sierdzio
                sierdzio Moderators last edited by

                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 Reply Quote 0
                • CAD_coding
                  CAD_coding last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • raven-worx
                    raven-worx Moderators last edited by

                    [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 Reply Quote 0
                    • First post
                      Last post