Skip to content

Commit fde6240

Browse files
committed
Do not paint WMS preview images. Because it crashes.
Fix #16803
1 parent 6f9798b commit fde6240

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/providers/wms/qgswmsprovider.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,11 +615,16 @@ static void _drawDebugRect( QPainter& p, const QRectF& rect, const QColor& color
615615

616616
QImage *QgsWmsProvider::draw( QgsRectangle const & viewExtent, int pixelWidth, int pixelHeight, QgsRasterBlockFeedback* feedback )
617617
{
618-
QgsDebugMsg( "Entering." );
618+
QImage* image = new QImage( pixelWidth, pixelHeight, QImage::Format_ARGB32 );
619+
620+
if ( QgsApplication::instance()->thread() == QThread::currentThread() )
621+
{
622+
QgsDebugMsg( "Trying to draw a WMS image on the main thread. Stop it!" );
623+
return image;
624+
}
619625

620626
// compose the URL query string for the WMS server.
621627

622-
QImage* image = new QImage( pixelWidth, pixelHeight, QImage::Format_ARGB32 );
623628
image->fill( 0 );
624629

625630
if ( !mSettings.mTiled && mSettings.mMaxWidth == 0 && mSettings.mMaxHeight == 0 )

0 commit comments

Comments
 (0)