Q: QApplication declaration "modifies" program result I am currently programming with Qt and I have a problem I don't understand. I'm not sure that this is caused by Qt.
I have this code:
cimg_library::CImg<float> img = model->convert("photo.jpg", 15);
model->save(img, "resIhm.jpg");

This works fine but when I introduce some QT code (here the declaration of the QApplication object) the method "convert" has different results..
QApplication *app = new QApplication(argc,argv);    
cimg_library::CImg<float> img = model->convert("photo.jpg", 15);
model->save(img, "resIhm.jpg");

But if I do this:
cimg_library::CImg<float> img = model->convert("photo.jpg", 15);
model->save(img, "resIhm.jpg");
QApplication *app = new QApplication(argc,argv); 

It works again. In fact those two lines of code are normally executed in a Qt SLOT so I have to declare my QApplication object before.
I'm sure that without the QApplication declaration it works. This code is in my main function, for debugging purpose.
In addition, when I use QCoreApplication, it works too. Does Qt modifies C++ streams ? 
Thank's for your help :)
ps: I don't use Qt in my Model class.
EDIT: Model fonctions used (the aim is to convert an image into an ASCII Art):
CImg<float> Model::convert(const char* source, int tailleCaracteres) const throw (ConversionException) {
try {
  CImg<float> image(source);

  image.normalize(0,50);
  int nbRef = 95;
  CImgList<float> refCode(nbRef, tailleCaracteres, tailleCaracteres, 1, 3);

  float white[3] = {255,255,255};
  float black[3] = {0,0,0};

  int i = 0;
  for (char l=' '; l<='~'; l++) {
    if(l == '%') {
  char ch[3] = "";
  ch[0] = '%';
  ch[1] = l;
  ch[2] = '\0';
  refCode(i).draw_text(0, 0, ch, white, black, 1, tailleCaracteres);
    } else {
  char ch[2] = "";
  ch[0] = l;
  ch[1] = '\0';
  refCode(i).draw_text(0, 0, ch, white, black, 1, tailleCaracteres);
    }
    i++;
  }
  CImg<float> imgDest;
  CImgList<float> cols = image.get_split('y', -tailleCaracteres);

  for(unsigned int i=0; i<cols.size(); i++) {
    CImgList<float> rows = cols(i).get_split('x', -tailleCaracteres);
    CImg<float> destRows;

    for(unsigned int j=0; j<rows.size(); j++) {
      int indice = recupImgProcheErreur(rows(j), refCode);
  destRows.append(refCode(indice), 'x');
}
    imgDest.append(destRows, 'y');
  }
  return  imgDest;
}
catch (CImgIOException exp) {
  throw ConversionException(std::string(exp.what())); 
}
}


int Modele::calculErreur(CImg<float> img, CImg<float> car) const {
  int erreur = 0;
  cimg_forX(img, i) {
    cimg_forY(img, j) {
        erreur += img(i,j,0,0) - car.atXY(i,j);
    }
  }
  return erreur;
}


void Modele::save(CImg<float> img, const char* pathDestination) const {
  img.save(pathDestination);
}

Valgrind tell me that there is a problem at this line (conditional jump or move depend on uninitialised values):
    erreur += img(i,j,0,0) - car.atXY(i,j);
I tried to fix it this afternoon but I failed.. I know that it comes with car.atXY(i,j) (wich is the same, I think, as car(i,j,0,0)).
Sorry if you don't understand variables names, it's in French but don't hesitate to ask me :)
