title: Problem with QT save() function for QImage
body: <p>I have a problem which I have been trying to figure out for few days now. I am using OpenCV to get frames from a camera and then I am converting it to QImage and trying to save the frame on a disk. The problem I am facing is that if I compile/run the code in release/debug mode in visual studio then it works fine. If I run the executable created by visual studio for debug mode then it runs fine. But if I run the executable created by visual studio in release mode, the gui works well except that the QImage save() function doesn't work anymore. If I use OpenCV function for saving the frame then it works well in all modes. The QImage that I am trying to save is notNull because my comments text box displays the line I print inside but the save function returns false. I would really appreciate help. </p>
  
  <p>Here is a little code:</p>
  
  <p>Code for conversion between IplImage and QImage (I have also used another code, with the same result)</p>
  
  <pre><code>QImage A::IplImage2QImage(const IplImage *iplImage)
  {
      int height = iplImage-&gt;height;
      int width = iplImage-&gt;width; 
      if (iplImage-&gt;depth == IPL_DEPTH_8U &amp;&amp; iplImage-&gt;nChannels == 3) {
          const uchar *qImageBuffer = (const uchar*)iplImage-&gt;imageData;
          QImage img(qImageBuffer, width, height, QImage::Format_RGB888); 
          return img.rgbSwapped();
      }
      else {
          // qWarning() &lt;&lt; "Image cannot be converted.";  
          return QImage();
      }
  }
  
  void A::getFrame()
  {
      commentsTextBox-&gt;setText("getFrame");
      if (VI.isFrameNew(device1)) {
          VI.getPixels(device1, (unsigned char *)frame-&gt;imageData, false, true);
      }
      QImage qimg2 = IplImage2QImage(frame);
      m_Label-&gt;setPixmap(QPixmap::fromImage(qimg2));
      if (!qimg2.isNull()) {
          x = qimg2.save("C:\\Data\\test.jpg");
          commentsTextBox-&gt;append("notEmpty33"); 
      }
  }
  </code></pre>