Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
3nids committed Oct 25, 2018
1 parent 699d848 commit bf5537e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -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
Expand Down

0 comments on commit bf5537e

Please sign in to comment.