Skip to content

Commit c1ce03c

Browse files
committedOct 19, 2018
test that window handle actually exists (avoid crash in tests)
1 parent 35ec465 commit c1ce03c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
173173

174174
// keep device pixel ratio up to date on screen or resolution change
175175
connect( window()->windowHandle(), &QWindow::screenChanged, this, [ = ]( QScreen * ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );
176-
connect( window()->windowHandle()->screen(), &QScreen::physicalDotsPerInchChanged, [ = ]( qreal ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );
176+
if ( window()->windowHandle() )
177+
connect( window()->windowHandle()->screen(), &QScreen::physicalDotsPerInchChanged, [ = ]( qreal ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );
177178

178179
connect( &mMapUpdateTimer, &QTimer::timeout, this, &QgsMapCanvas::mapUpdateTimeout );
179180
mMapUpdateTimer.setInterval( 250 );

0 commit comments

Comments
 (0)
Please sign in to comment.