Skip to content

Commit bc30cdf

Browse files
committed
Followup c9251c, fix crash
1 parent 3bdc77d commit bc30cdf

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

python/core/layertree/qgslayertreemodellegendnode.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class QgsSymbolLegendNode : QgsLayerTreeModelLegendNode
156156
* render context in advance and call this method instead of minimumIconSize().
157157
* @note added in QGIS 2.18
158158
*/
159-
QSize minimumIconSize( QgsRenderContext &context ) const;
159+
QSize minimumIconSize( QgsRenderContext* context ) const;
160160

161161
/** Returns the symbol used by the legend node.
162162
* @see setSymbol()

src/core/layertree/qgslayertreemodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ void QgsLayerTreeModel::invalidateLegendMapBasedData()
14971497
QgsSymbolLegendNode* n = dynamic_cast<QgsSymbolLegendNode*>( legendNode );
14981498
if ( n )
14991499
{
1500-
const QSize sz( n->minimumIconSize( *context ) );
1500+
const QSize sz( n->minimumIconSize( context.data() ) );
15011501
const QString parentKey( n->data( QgsLayerTreeModelLegendNode::ParentRuleKeyRole ).toString() );
15021502
widthMax[parentKey] = qMax( sz.width(), widthMax.contains( parentKey ) ? widthMax[parentKey] : 0 );
15031503
n->setIconSize( sz );

src/core/layertree/qgslayertreemodellegendnode.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,25 @@ Qt::ItemFlags QgsSymbolLegendNode::flags() const
159159
QSize QgsSymbolLegendNode::minimumIconSize() const
160160
{
161161
QScopedPointer<QgsRenderContext> context( createTemporaryRenderContext() );
162-
return minimumIconSize( *context );
162+
return minimumIconSize( context.data() );
163163
}
164164

165-
QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext& context ) const
165+
QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext* context ) const
166166
{
167167
QSize minSz( 16, 16 );
168168
if ( mItem.symbol() && mItem.symbol()->type() == QgsSymbol::Marker )
169169
{
170170
minSz = QgsImageOperation::nonTransparentImageRect(
171171
QgsSymbolLayerUtils::symbolPreviewPixmap( mItem.symbol(), QSize( 512, 512 ),
172-
&context ).toImage(),
172+
context ).toImage(),
173173
minSz,
174174
true ).size();
175175
}
176176
else if ( mItem.symbol() && mItem.symbol()->type() == QgsSymbol::Line )
177177
{
178178
minSz = QgsImageOperation::nonTransparentImageRect(
179179
QgsSymbolLayerUtils::symbolPreviewPixmap( mItem.symbol(), QSize( minSz.width(), 512 ),
180-
&context ).toImage(),
180+
context ).toImage(),
181181
minSz,
182182
true ).size();
183183
}

0 commit comments

Comments
 (0)