fix(preview): invalid shm permission

Change-Id: I92fded1fe82f415195628a4c942f28ec24e2b05b
This commit is contained in:
listenerri 2018-08-10 18:20:23 +08:00
parent 5808aba52f
commit ac1fca3e13
Notes: gerrit 2018-08-12 11:00:38 +08:00
Verified+1: <jenkins@deepin.com>
Code-Review+1: zccrs <ccrr1314@live.com>
Code-Review+2: hualet <mr.asianwang@gmail.com>
Submitted-by: listenerri <listenerri@gmail.com>
Submitted-at: Sun, 12 Aug 2018 11:00:38 +0800
Reviewed-on: https://cr.deepin.io/37614
Project: dde/dde-dock
Branch: refs/heads/master

View File

@ -143,9 +143,13 @@ void AppSnapshot::fetchSnapshot()
qDebug() << "get Image from dxcbplugin SHM...";
//qDebug() << info->shmid << info->width << info->height << info->bytesPerLine << info->format << info->rect.x << info->rect.y << info->rect.width << info->rect.height;
image_data = (uchar*)shmat(info->shmid, 0, 0);
m_snapshot = QImage(image_data, info->width, info->height, info->bytesPerLine, (QImage::Format)info->format);
m_snapshotSrcRect = QRect(info->rect.x, info->rect.y, info->rect.width, info->rect.height);
break;
if ((qint64)image_data != -1) {
m_snapshot = QImage(image_data, info->width, info->height, info->bytesPerLine, (QImage::Format)info->format);
m_snapshotSrcRect = QRect(info->rect.x, info->rect.y, info->rect.width, info->rect.height);
break;
}
qDebug() << "invalid pointer of shm!";
image_data = nullptr;
}
if (!image_data || qimage.isNull())