On sexta-feira, 27 de setembro de 2013 23:13:44, Alexander Syvak wrote: > This is the code of the function saving screenshots. This code is used in > threads analizing screenshots. > Debugging the app. when one thread has been paused inside QImage save > method and other thread wake up invoking the lines below
On the *same* QImage? Like I said, I need to know what each thread is doing. Saving a QImage from any thread should be acceptable, provided no other thread is using the same QImage. > > QFile screenshot_iodev(mk_screenshot_path(screenshot_idx++)); > > return screenshot.save( &screenshot_iodev, format_raw_ptr ); > > where QImage::save returns false failing here > > bool QImageWriter::canWrite() const > > { > > if (d->device && !d->handler && (d->handler = > createWriteHandlerHelper(d->device, d->format)) == 0) { > > d->imageWriterError = QImageWriter::UnsupportedFormatError; > > d->errorString = QT_TRANSLATE_NOOP(QImageWriter, > > QLatin1String("Unsupported > image format")); > > return false; > > } > > > > > > > 2013/9/27 Thiago Macieira <thiago.macie...@intel.com> > > > On sexta-feira, 27 de setembro de 2013 16:12:37, Alexander Syvak wrote: > > > Hello, > > > > > > the method save_screenshot() is used to save a QImage object using > > > bool QImage::save ( const > > > QString<http://doc.crossplatform.ru/qt/4.6.x/qstring.html>& > > > *fileName*, const char * *format* = 0, int *quality* = -1 ) const > > > > > > Howver, it appears that QImage is working with one I/O device and > > > returns > > > false if it's busy, i.e. a thread paused at a moment of executing the > > > > save > > > > > method. > > > > Any thread? What is this other thread doing? Also, threads don't pause > > except > > if you're using the debugger. > > > > It's far more likely that your mistake can be found in what this other > > thread > > is doing. > > > > > Is it better to use > > > bool QImage::save ( > > > QIODevice<http://doc.crossplatform.ru/qt/4.6.x/qiodevice.html>* > > > *device*, const char * *format* = 0, int *quality* = -1 ) const > > > > > > method instead with its own I/O device for each thread or > > > > > > to create QMutexLocker in the save_screenshot() method? > > > > -- > > Thiago Macieira - thiago.macieira (AT) intel.com > > > > Software Architect - Intel Open Source Technology Center > > > > _______________________________________________ > > Interest mailing list > > Interest@qt-project.org > > http://lists.qt-project.org/mailman/listinfo/interest -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest