Skip to content

Commit

Permalink
Fix a crash after adding favourites to browser when the item is not y…
Browse files Browse the repository at this point in the history
…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 0aeea52
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/qgsdataitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -738,7 +739,8 @@ void QgsFavouritesItem::removeDirectory( QgsDirectoryItem *item )
return;
}

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

//-----------------------------------------------------------------------
Expand Down

0 comments on commit 0aeea52

Please sign in to comment.