Skip to content

Commit 0aeea52

Browse files
committedOct 29, 2014
Fix a crash after adding favourites to browser when the item is not yet populated
The model was getting broken due to list of children being overwritten and it was sometimes crashing in the proxy model implementation.
1 parent 0a875d3 commit 0aeea52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/core/qgsdataitem.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,8 @@ void QgsFavouritesItem::addDirectory( QString favDir )
718718
favDirs.append( favDir );
719719
settings.setValue( "/browser/favourites", favDirs );
720720

721-
addChildItem( new QgsDirectoryItem( this, favDir, favDir ), true );
721+
if ( mPopulated )
722+
addChildItem( new QgsDirectoryItem( this, favDir, favDir ), true );
722723
}
723724

724725
void QgsFavouritesItem::removeDirectory( QgsDirectoryItem *item )
@@ -738,7 +739,8 @@ void QgsFavouritesItem::removeDirectory( QgsDirectoryItem *item )
738739
return;
739740
}
740741

741-
deleteChildItem( mChildren[idx] );
742+
if ( mPopulated )
743+
deleteChildItem( mChildren[idx] );
742744
}
743745

744746
//-----------------------------------------------------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.