BMenu::InvalidateLayout() should only sets a variable, the real invalidation is done on Draw() or AttachedToWindow() (like on R5). This fixes bug 567 (at least the crash in HotEdit)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17356 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-05-07 19:58:07 +00:00
parent 4eb16023d1
commit 63b7888854
+13 -5
View File
@@ -284,8 +284,10 @@ BMenu::AttachedToWindow()
} while (AddDynamicItem(B_PROCESSING)); } while (AddDynamicItem(B_PROCESSING));
} }
if (!fAttachAborted) if (!fAttachAborted) {
InvalidateLayout(); CacheFontInfo();
LayoutItems(0);
}
} }
@@ -742,6 +744,14 @@ BMenu::KeyDown(const char *bytes, int32 numBytes)
void void
BMenu::Draw(BRect updateRect) BMenu::Draw(BRect updateRect)
{ {
if (!fUseCachedMenuLayout) {
fUseCachedMenuLayout = true;
CacheFontInfo();
LayoutItems(0);
Invalidate();
return;
}
DrawBackground(updateRect); DrawBackground(updateRect);
DrawItems(updateRect); DrawItems(updateRect);
} }
@@ -778,9 +788,7 @@ BMenu::FrameResized(float new_width, float new_height)
void void
BMenu::InvalidateLayout() BMenu::InvalidateLayout()
{ {
CacheFontInfo(); fUseCachedMenuLayout = false;
LayoutItems(0);
Invalidate();
} }