Skip to content

Commit

Permalink
Possible fix for crash that occurred when external monitor was switch…
Browse files Browse the repository at this point in the history
…ed on MacOS
  • Loading branch information
ibooij committed Feb 2, 2020
1 parent df5bf45 commit 2400e07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/opengl/OpenGLVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ void OpenGLVideo::updateViewport()
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QSizeF surfaceSize = d.ctx->surface()->size();
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
surfaceSize *= d.ctx->screen()->devicePixelRatio();
// When changing monitors (plugging and unplugging), the screen might sometimes be nullptr!
if (d.ctx->screen()) {
surfaceSize *= d.ctx->screen()->devicePixelRatio();
}
#else
surfaceSize *= qApp->devicePixelRatio(); //TODO: window()->devicePixelRatio() is the window screen's
#endif
Expand Down

0 comments on commit 2400e07

Please sign in to comment.