Skip to content
Browse files

fix crash when changing screen while rendering

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 b0104a2 commit 4147aaabeb9d65ee58d63050b1944179f5cf58a8
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/gui/qgsmapcanvas.cpp
@@ -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() );
// 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" ) );
#if QT_VERSION >= 0x050600
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatioF();

0 comments on commit 4147aaa

Please sign in to comment.
You can’t perform that action at this time.