forked from qt-creator/qt-creator
Debugger: Do not crash when displaying uninitialized QImages
Fixes: QTCREATORBUG-23031 Change-Id: I074cdaf509edac6e5659d2e976ed7188e8944d81 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -2296,6 +2296,10 @@ void WatchModel::showEditValue(const WatchItem *item)
|
||||
QTC_ASSERT(0 < nbytes && nbytes < 10000 * 10000, return);
|
||||
QTC_ASSERT(0 < imformat && imformat < 32, return);
|
||||
QImage im(width, height, QImage::Format(imformat));
|
||||
const qsizetype size = im.sizeInBytes();
|
||||
// If our computation of image size doesn't fit the client's
|
||||
// chances are that we can't properly display it either.
|
||||
if (size == nbytes) {
|
||||
std::memcpy(im.bits(), bits, nbytes);
|
||||
auto v = m_separatedView->prepareObject<ImageViewer>(item);
|
||||
v->setInfo(item->address ?
|
||||
@@ -2305,6 +2309,7 @@ void WatchModel::showEditValue(const WatchItem *item)
|
||||
.arg(width).arg(height).arg(nbytes).arg(im.format()).arg(im.depth())
|
||||
);
|
||||
v->setImage(im);
|
||||
}
|
||||
} else if (format == DisplayLatin1String
|
||||
|| format == DisplayUtf8String
|
||||
|| format == DisplayUtf16String
|
||||
|
Reference in New Issue
Block a user