Skip to content

Commit

Permalink
Merge pull request wang-bin#1274 from ibooij/fix-macos-crash-on-scree…
Browse files Browse the repository at this point in the history
…n-change

Possible fix for crash that occurred when external monitor was (un)plugged
  • Loading branch information
wang-bin authored Feb 5, 2020
2 parents df5bf45 + 2400e07 commit 0307c17
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 0307c17

Please sign in to comment.