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.
This commit is contained in:
Denis Rouzaud 2018-10-25 08:03:27 -08:00 committed by GitHub
parent 699d8487dc
commit bf5537e230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -690,7 +690,13 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage &img, const QgsMapSettings &m
// expects (encoding of position and size of the item)
const QgsMapToPixel &m2p = mapSettings.mapToPixel();
QgsPointXY topLeft = m2p.toMapCoordinates( 0, 0 );
Q_ASSERT( img.devicePixelRatio() == mapSettings.devicePixelRatio() );
#ifdef QGISDEBUG
// do not assert this, since it might lead to crashes when changing screen while rendering
if ( img.devicePixelRatio() != mapSettings.devicePixelRatio() )
{
QgsLogger::warning( QStringLiteral( "The renderer map has a wrong device pixel ratio" ) );
}
#endif
#if QT_VERSION >= 0x050600
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatioF();
#else