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. Strange behavior in Release mode but not in Debug mode
Forum Updated to NodeBB v4.3 + New Features

Strange behavior in Release mode but not in Debug mode

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.9k Views 1 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.
  • S Offline
    S Offline
    sergex
    wrote on last edited by
    #1

    Hello,

    I have a strange problem that I'm stuck at the moment, when I run my application in Debug mode everything works perfectly fine, but when I just switch to Release mode there are some functions in my code that don't get called. One of these functions runs an executable with QProcess.

    Is there any reason why this might happen? I tried cleaning and rebuilding my project but had no luck.
    What can I do to fix something like this ?

    I am on Windows 7, using Qt 5.1 and QtCreator 2.8 if that helps..

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Without any code it's pretty much crystal ball debugging.

      Do you have maybe these functions called in an assert statement ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        or some uninitialized variables? In debug mode everything gets 0-initialized, in release you get random garbage.

        @SGaist - is crystal ball debugging something like "this method":http://en.wikipedia.org/wiki/Rubber_duck_debugging ? :)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sergex
          wrote on last edited by
          #4

          No, I have no assert methods. This is what I have:

          First I make my QProcess and connect a signal to a slot.
          @
          m_process = new QProcess(this);
          connect(m_process, SIGNAL(finished(int)),
          this, SLOT(processDone()));
          @

          A function called processFile() getscalled :
          Here I just set up the arguments and start my QProcess.
          @
          void MyWidget::processFile()
          {
          // Getting .exe file path
          QString mExe = QDir::currentPath() + "/untitled.exe";

          QStringList args;
          QString file1 = m_currentlySelectedListItem;
          QString file2 = m_lastItem;
          args.append(file1);
          args.append(file2);
          args.append("trim");
          args.append(QString::number(0.1455));
          
          m_Process->start(mExe, args);
          
          // This is where it stops, it won't go further...
          qDebug() << "------------ END OF FUNCTION ------------ ";
          

          }
          @

          Since I connected the finished() signal of my QProcess to a slot in Debug mode the slot gets called and everything works fine. In release mode it stops there in the comment and the slot never gets called.
          What am I doing wrong ?

          Thanks for your help!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            [quote author="Chris Kawa" date="1378761865"]
            @SGaist - is crystal ball debugging something like "this method":http://en.wikipedia.org/wiki/Rubber_duck_debugging ? :)[/quote]

            Almost, it depends whether you can contact the duck or not :)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @QString mExe = QDir::currentPath() + "/untitled.exe"@

              Are you sure this path is correct in both build ? i.e. is it really untitled.exe in debug mode ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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