HaikuDepot: Fixed potential dead-lock in package list refresh.
When the package list was refreshed while package info was still being pulled from the web app, calling Model::Clear() with the model lock already held could lead to a dead-lock: The package populator could block on the model lock to update information, while StopPopulatingAllPackages() waited for the thread to exit, but held the lock that the thread was blocking on. So call StopPopulatingAllPackages() before grabbing the lock and calling Clear() in MainWindow::_RefreshPackageList().
This commit is contained in:
@@ -421,7 +421,6 @@ Model::AddDepot(const DepotInfo& depot)
|
||||
void
|
||||
Model::Clear()
|
||||
{
|
||||
StopPopulatingAllPackages();
|
||||
fDepots.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -743,8 +743,9 @@ MainWindow::_RefreshPackageList()
|
||||
systemFlaggedPackages.Add(repoPackageInfo.FileName());
|
||||
}
|
||||
|
||||
BAutolock lock(fModel.Lock());
|
||||
fModel.StopPopulatingAllPackages();
|
||||
|
||||
BAutolock lock(fModel.Lock());
|
||||
fModel.Clear();
|
||||
|
||||
// filter remote packages from the found list
|
||||
|
||||
Reference in New Issue
Block a user