Recently I've been testing my Qt 5.5 C++ (Win7) program on one older laptop and found a weird bug, namely I'm displaying camera image and on some action (when letter P is pressed on keyboard) save that image in Pictures folder. Everything works fine (on P click image is saved) until I start new thread (for doing some background process). After the new thread is started, on "take a picture" event nothing happens (image is not visible in Pictures folder; onImageError[/ is not called) and after I close the application all images that are being captured are saved.

I'm not sure if I made myself clear so here is one more time steps I perform:
Open app -> take a photo -> photo is saved -> start new thread -> take couple of pictures (they are not saved) -> close app -> app closed (ALL pictures are saved)

The important part I have to mention is that all object I use (QCamera, QCameraImageCapture and thread that I start) are pointers.
And I am not 100% sure that starting this thread cause the issue but every time I start the thread, images are not saved.

Here are source that I am using:

Capturing camera image:
Qt Code:
  1. void MyClass::onCameraSeleced(QCameraInfo camera_info) {
  2. camera_ = new QCamera(camera_info);
  3. pture(camera_);
  4. camera_image_capture_->setCaptureDestination(QCameraImageCapture::CaptureToFile);
  5.  
  6. camera_image_capture_ = new QCameraImageCa
  7. // connect to capture signals
  8. connect(camera_image_capture_, SIGNAL(imageCaptured(int, const QImage&)),
  9. this, SLOT(onImageCaptured(int, const QImage&)));
  10. connect(camera_image_capture_, SIGNAL(imageSaved(int, const QString&)),
  11. this, SLOT(onImageSaved(int, const QString&)));
  12. connect(camera_image_capture_, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this,
  13. SLOT(onImageError(int,QCameraImageCapture::Error,QString)));
  14.  
  15. camera_->setCaptureMode(QCamera::CaptureStillImage);
  16. camera_->setViewfinder(ui->cameraWidget);
  17. camera_->start();
  18. }
  19.  
  20. void MyClass::takeScreenShot(){
  21. camera_->searchAndLock();
  22.  
  23. camera_image_capture_->capture(name);
  24.  
  25. camera_->unlock();
  26. }
  27.  
  28. MyClass::~MyClass()
  29. {
  30. if(camera_ != NULL)
  31. {
  32. camera_->unload();
  33. delete camera_;
  34. }
  35. }
To copy to clipboard, switch view to plain text mode 

Starting new thread that cause this issue:
Qt Code:
  1. my_thread_ = new MyThread();
  2.  
  3. QThreadPool::globalInstance()->start(my_thread_);
To copy to clipboard, switch view to plain text mode 

MyThread:
Qt Code:
  1. void MyThread::run()
  2. {
  3. while(run_)
  4. {
  5. .
  6. .
  7. .
  8. QThread::msleep(static_speed_yaw_data_->getTimeInterval());
  9. }
  10. }
To copy to clipboard, switch view to plain text mode