Could the QImage image object be the problem?

I think after I load the file using the below code, the image object somehow gets destroyed after the function. What do you think?

Qt Code:
  1. void MainWindow::open()
  2. {
  3. QString fileName = QFileDialog::getOpenFileName(this,tr("Open File"), QDir::currentPath(), tr("Image Files (*.jpg *.jpeg *.bmp *.gif *.png)"));
  4. if (!fileName.isEmpty()) {
  5. QImage image(fileName);
  6. if (image.isNull()) {
  7. QMessageBox::critical(this, tr("Image View"), tr("Cannot load %1.").arg(fileName));
  8. return;
  9. }
  10. imageLabel->setPixmap(QPixmap::fromImage(image));
  11. scaleFactor = 1.0;
  12. closeAction->setEnabled(true);
  13. imageLabel->adjustSize();
  14.  
  15. imagelabFile.convertToRGBImage(image); //If loading is ok, create an imagelabfile copy of the QImage
  16. brightnessAction->setEnabled(true);
  17. QMessageBox::information(this, tr("Successful Conversion"),tr("ImageLab image loaded. Ready for processing."));
  18. }
  19. }
To copy to clipboard, switch view to plain text mode