Skip to content
Permalink
Browse files

Don't assume qobject_cast works on objects currently being deleted

  • Loading branch information
m-kuhn committed Jul 3, 2016
1 parent f3bfef4 commit dd715b233b4d23bc6c2bfe24e584108d8dcc9227
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/core/qgsmaplayerregistry.cpp
@@ -151,11 +151,11 @@ void QgsMapLayerRegistry::removeMapLayers( const QList<QgsMapLayer*>& layers )
QString myId( lyr->id() );
emit layerWillBeRemoved( myId );
emit layerWillBeRemoved( lyr );
mMapLayers.remove( myId );
if ( lyr->parent() == this )
{
delete lyr;
}
mMapLayers.remove( myId );
emit layerRemoved( myId );
}

@@ -192,10 +192,7 @@ void QgsMapLayerRegistry::reloadAllLayers()

void QgsMapLayerRegistry::onMapLayerDeleted( QObject* obj )
{
QgsMapLayer* ml = qobject_cast<QgsMapLayer*>( obj );
Q_ASSERT( ml );

QString id = mMapLayers.key( ml );
QString id = mMapLayers.key( static_cast<QgsMapLayer*>( obj ) );

if ( !id.isNull() )
{

0 comments on commit dd715b2

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