Permalink
Browse files

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

  • Loading branch information...
1 parent 11e5194 commit 46db18d19961c418116e83cca2edc8c59ad40f3f @stpere stpere committed Nov 18, 2012
Showing with 4 additions and 8 deletions.
  1. +4 −8 src/apps/diskusage/ControlsView.cpp
View
12 src/apps/diskusage/ControlsView.cpp
@@ -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);

0 comments on commit 46db18d

Please sign in to comment.