Skip to content

Commit bf5537e

Browse files
authoredOct 25, 2018
fix crash when changing screen while rendering (#8328)
remove this assert since by the time the map is rendered the screen changed and might not have the same DPR.
1 parent 699d848 commit bf5537e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,13 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage &img, const QgsMapSettings &m
690690
// expects (encoding of position and size of the item)
691691
const QgsMapToPixel &m2p = mapSettings.mapToPixel();
692692
QgsPointXY topLeft = m2p.toMapCoordinates( 0, 0 );
693-
Q_ASSERT( img.devicePixelRatio() == mapSettings.devicePixelRatio() );
693+
#ifdef QGISDEBUG
694+
// do not assert this, since it might lead to crashes when changing screen while rendering
695+
if ( img.devicePixelRatio() != mapSettings.devicePixelRatio() )
696+
{
697+
QgsLogger::warning( QStringLiteral( "The renderer map has a wrong device pixel ratio" ) );
698+
}
699+
#endif
694700
#if QT_VERSION >= 0x050600
695701
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatioF();
696702
#else

0 commit comments

Comments
 (0)
Please sign in to comment.