Skip to content

Commit

Permalink
fix #273525: Crash on template search
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Jun 20, 2018
1 parent be32f74 commit 60cae43
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mscore/scoreBrowser.cpp
Expand Up @@ -64,6 +64,7 @@ ScoreBrowser::ScoreBrowser(QWidget* parent)
scoreList->layout()->setMargin(0);
_noMatchedScoresLabel = new QLabel(tr("There are no templates matching the current search."));
_noMatchedScoresLabel->setHidden(true);
_noMatchedScoresLabel->setObjectName("noMatchedScoresLabel");
scoreList->layout()->addWidget(_noMatchedScoresLabel);
connect(preview, SIGNAL(doubleClicked(QString)), SIGNAL(scoreActivated(QString)));
if (!_showPreview)
Expand Down Expand Up @@ -180,8 +181,11 @@ void ScoreBrowser::setScores(QFileInfoList& s)
QLayoutItem* child;
while (l->count()) {
child = l->takeAt(0);
if(child->widget() != 0)
if (child->widget() != 0) {
if (child->widget()->objectName() == "noMatchedScoresLabel") // do not delete
continue;
delete child->widget();
}
delete child;
}

Expand Down Expand Up @@ -276,14 +280,14 @@ void ScoreBrowser::selectLast()
ScoreItem* item = static_cast<ScoreItem*>(w->item(w->count()-1));
w->setCurrentItem(item);
preview->setScore(item->info());
}
}

//---------------------------------------------------------
// filter
// filter which scores are visible based on searchString
//---------------------------------------------------------
void ScoreBrowser::filter(const QString &searchString)
{
{
int numCategoriesWithMathingScores = 0;

for (ScoreListWidget* list : scoreLists) {
Expand Down Expand Up @@ -313,7 +317,7 @@ void ScoreBrowser::filter(const QString &searchString)
}

_noMatchedScoresLabel->setHidden(numCategoriesWithMathingScores > 0);
}
}

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

0 comments on commit 60cae43

Please sign in to comment.