Qt: Fix race condition in Qt display driver that could cause division by zero

This commit is contained in:
Vicki Pfau 2024-04-14 20:22:11 -07:00
parent e8e6b803f2
commit be85200b3e
1 changed files with 4 additions and 0 deletions

View File

@ -130,6 +130,10 @@ void DisplayQt::paintEvent(QPaintEvent*) {
struct mRectangle frame;
VideoBackendGetFrame(&m_backend, &frame);
QPoint origin(-frame.x, -frame.y);
QSize drawSize(contentSize());
if (!drawSize.isValid() || drawSize.width() < 1 || drawSize.height() < 1) {
return;
}
QRect full(clampSize(contentSize(), size(), isAspectRatioLocked(), isIntegerScalingLocked()));
painter.save();
painter.translate(full.topLeft());