Skip to content
Permalink
Browse files

Fix a crash after adding favourites to browser when the item is not y…

…et populated

The model was getting broken due to list of children being overwritten and
it was sometimes crashing in the proxy model implementation.
  • Loading branch information
wonder-sk committed Oct 29, 2014
1 parent 0a875d3 commit 0aeea528c47a896b96e02ac07494eaf2c8977667
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/core/qgsdataitem.cpp
@@ -718,7 +718,8 @@ void QgsFavouritesItem::addDirectory( QString favDir )
favDirs.append( favDir );
settings.setValue( "/browser/favourites", favDirs );

addChildItem( new QgsDirectoryItem( this, favDir, favDir ), true );
if ( mPopulated )
addChildItem( new QgsDirectoryItem( this, favDir, favDir ), true );
}

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

deleteChildItem( mChildren[idx] );
if ( mPopulated )
deleteChildItem( mChildren[idx] );
}

//-----------------------------------------------------------------------

0 comments on commit 0aeea52

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