Fix crash when calling QMainWindow::restoreState()
Restoring the state of a window with a dock widget could cause a crash in a multiple display configuration if the scale or screen arrangement in the system had changed after the state was saved. In this case, the original top-left coordinate of the window could now lie outside of any screens, which would result in a NULL QScreen pointer being dereferenced inside QDockAreaLayout::constrainedRect(). Fixes: QTBUG-102718 Fixes: QTBUG-102541 Pick-to: 6.2 6.3 Change-Id: Ie5e3209b82a33a1dc4568611c1b2ee3a6d8830b7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
d42ad7b01e
commit
53c8d0d40b
|
|
@ -3018,10 +3018,10 @@ QSize QDockAreaLayout::minimumStableSize() const
|
|||
*/
|
||||
QRect QDockAreaLayout::constrainedRect(QRect rect, QWidget* widget)
|
||||
{
|
||||
QScreen *screen;
|
||||
QScreen *screen = nullptr;
|
||||
if (QGuiApplication::primaryScreen()->virtualSiblings().size() > 1)
|
||||
screen = QGuiApplication::screenAt(rect.topLeft());
|
||||
else
|
||||
if (!screen)
|
||||
screen = widget->screen();
|
||||
|
||||
const QRect screenRect = screen->geometry();
|
||||
|
|
|
|||
Loading…
Reference in New Issue