Skip to content
Browse files
Followup 01b4eeb: Fix crash
  • Loading branch information
m-kuhn committed Jun 17, 2017
1 parent cb1f98f commit 8bfbe195ae597d6b2e2ef50194fd3fbd87205391
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/providers/virtual/qgsvirtuallayersourceselect.cpp
@@ -249,8 +249,8 @@ void QgsVirtualLayerSourceSelect::updateLayersList()
QgsLayerTreeModel *model = qobject_cast<QgsLayerTreeModel *>( mTreeView->model() );
Q_FOREACH ( QgsLayerTreeLayer *layer, model->rootGroup()->findLayers() )
Q_ASSERT( layer->layer() );
if ( layer->layer()->type() == QgsMapLayer::VectorLayer && static_cast<QgsVectorLayer *>( layer->layer() )->providerType() == QLatin1String( "virtual" ) )
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer->layer() );
if ( vl && vl->providerType() == QLatin1String( "virtual" ) )
// store layer's id as user data
mLayerNameCombo->addItem( layer->layer()->name(), layer->layer()->id() );

2 comments on commit 8bfbe19


This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Jun 17, 2017

@elpaso This replaces a previous commit from you (01b4eeb)
I assume you wanted to fix the crash and not assessing in detail why layer->layer() can be a nullptr and enforce that this never happens, right?
This randomly crashes for me once in a while when reloading projects.


This comment has been minimized.

Copy link

@elpaso elpaso replied Jun 19, 2017

@m-kuhn yes, I've ran into that bug while working on the new layers dialog, my first attempt was to add a check for layer() like you did (well, almost like you did: my check was on the uncasted layer() ) , but after adding Qt::QueuedConnection I was not able to reproduce the issue anymore and I though that it was solved, apparently I was mistaken, thanks for fixing it.

Please sign in to comment.