Skip to content

Commit 032b4ad

Browse files
committed
Fix segfault when html composer labels contain img tags
1 parent 007e237 commit 032b4ad

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core/composer/qgscomposerlabel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
8181
webPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
8282
webPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
8383

84+
// QGIS segfaults when rendering web page while in composer if html
85+
// contains images. So if we are not printing the composition, then
86+
// disable image loading
87+
if ( mComposition->plotStyle() != QgsComposition::Print &&
88+
mComposition->plotStyle() != QgsComposition::Postscript )
89+
{
90+
webPage->settings()->setAttribute( QWebSettings::AutoLoadImages, false );
91+
}
92+
8493
//Connect timeout and webpage loadFinished signals to loop
8594
connect( &timeoutTimer, SIGNAL( timeout() ), &loop, SLOT( quit() ) );
8695
connect( webPage, SIGNAL( loadFinished( bool ) ), &loop, SLOT( quit() ) );

0 commit comments

Comments
 (0)