Skip to content

Commit 36bf49d

Browse files
committedJul 9, 2013
browser: emit layoutAboutToBeChanged() before destroying home item (fixes #8221)
1 parent 682a89c commit 36bf49d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/core/qgsbrowsermodel.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ QgsBrowserModel::~QgsBrowserModel()
4545

4646
void QgsBrowserModel::updateProjectHome()
4747
{
48-
int idx = mRootItems.indexOf( mProjectHome );
4948
QString home = QgsProject::instance()->homePath();
50-
51-
delete mProjectHome;
49+
if ( mProjectHome && mProjectHome->path() == home )
50+
return;
5251

5352
emit layoutAboutToBeChanged();
53+
54+
int idx = mRootItems.indexOf( mProjectHome );
55+
delete mProjectHome;
5456
mProjectHome = home.isNull() ? 0 : new QgsDirectoryItem( NULL, tr( "Project home" ), home );
5557
if ( mProjectHome )
5658
{
@@ -64,6 +66,7 @@ void QgsBrowserModel::updateProjectHome()
6466
{
6567
mRootItems.remove( idx );
6668
}
69+
6770
emit layoutChanged();
6871
}
6972

0 commit comments

Comments
 (0)
Please sign in to comment.