fix: fix some window preview crash

get a QImage copy data to prevent XDestroyImage clear image data which make a empty QImage

log:
This commit is contained in:
tsic404 2023-03-13 13:16:55 +08:00 committed by deepin-bot[bot]
parent e8fc0b7735
commit 7a8f2c835a

View File

@ -226,7 +226,7 @@ void AppSnapshot::fetchSnapshot()
emit requestCheckWindow();
return;
}
qimage = QImage((const uchar *)(ximage->data), ximage->width, ximage->height, ximage->bytes_per_line, QImage::Format_RGB32);
qimage = QImage(reinterpret_cast<uchar*>(ximage->data), ximage->width, ximage->height, ximage->bytes_per_line, QImage::Format_RGB32).copy();
}
Q_ASSERT(!qimage.isNull());