Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25509

Wrong result or crash on copy/paste to/from clipboard QImage with Format_RGB888

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.6.2
    • Image formats
    • None
    • WinXP SP3

    Description

      After adding QImage with Format_RGB888 to clipboard and paste to third party application either image is pasted corrupted or QT application crashes with access violation.

      Simple code exam that reproduces the issue.

      #include <iostream>
      #include <QApplication>
      #include <QClipboard>
      #include <QMimeData>
      #include <QImage>
      #include <QDebug>
      
      int main(int argc, char* argv[])
      {
      	{
      		QApplication app(argc, argv);
      		QImage img;
      		if (img.load("c:/WINDOWS/winnt.bmp") && !img.isNull())
      		{
      			qDebug() << img.size().width() << "*" << img.size().height() << " bytecount=" << img.byteCount() << " bytesPerLine=" << img.bytesPerLine() << " depth=" << img.depth() << " format=" << img.format();
      			img = img.convertToFormat(QImage::Format_RGB888);
      			qDebug() << img.size().width() << "*" << img.size().height() << " bytecount=" << img.byteCount() << " bytesPerLine=" << img.bytesPerLine() << " depth=" << img.depth() << " format=" << img.format();
      			QMimeData* pMimeData = new QMimeData();
      			pMimeData->setImageData(img);
      			QApplication::clipboard()->setMimeData(pMimeData);
      		}
      	}
      	return 0;
      }
      

      After running application above run MSPaint and paste from clipboard => image is corrupted (see CorruptedImage.bmp attached)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kkalland Kim Motoyoshi Kalland (Inactive)
            lkryvelyov Leonid Kryvelyov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes