DiskUsage: Truncating of tabs could lead to deadlock (#9170)

This commit is contained in:
Philippe Saint-Pierre
2012-11-17 22:00:47 -05:00
parent 11e5194844
commit 46db18d199
+4 -8
View File
@@ -73,8 +73,8 @@ VolumeTab::IconWidth() const
void
VolumeTab::DrawLabel(BView* owner, BRect frame)
{
owner->SetDrawingMode(B_OP_OVER);
if (fIcon != NULL) {
owner->SetDrawingMode(B_OP_OVER);
owner->MovePenTo(frame.left + kSmallHMargin,
(frame.top + frame.bottom - fIcon->Bounds().Height()) / 2.0);
owner->DrawBitmap(fIcon);
@@ -188,13 +188,9 @@ ControlsView::VolumeTabView::TabFrame(int32 index) const
oldToShave = toShave;
for (int32 i = 0; i < countTabs; i++) {
float iconWidth = ((VolumeTab*)TabAt(i))->IconWidth();
float newMargin = margins[i] - averageToShave;
toShave -= averageToShave;
if (newMargin < minimumMargin + iconWidth) {
toShave += minimumMargin - newMargin + iconWidth;
newMargin = minimumMargin + iconWidth;
}
float newMargin = max_c(margins[i] - averageToShave,
minimumMargin + iconWidth);
toShave -= margins[i] - newMargin;
margins[i] = newMargin;
}
} while (toShave > 0 && oldToShave != toShave);