Fix a bug in LayoutTest1, where we were getting the view of a view-less layout, and then calling methods on it, resulting in a (SURPRISE!) segfault.

This commit is contained in:
Alex Wilson 2011-10-22 19:39:44 -06:00
parent e7b0dc78f7
commit 954c5e46a1

View File

@ -338,7 +338,7 @@ struct GroupLayoutTest1 : public Test {
// row 2
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING, 2)
.GetView(&toggledRow)
.GetLayout(&toggledRow)
.Add(new TestView())
.Add(new TestView())
.Add(new TestView())
@ -362,10 +362,7 @@ struct GroupLayoutTest1 : public Test {
switch (message->what) {
case MSG_TOGGLE_1:
{
if (toggledRow->IsHidden(toggledRow))
toggledRow->Show();
else
toggledRow->Hide();
toggledRow->SetVisible(!toggledRow->IsVisible());
break;
}
@ -387,7 +384,7 @@ struct GroupLayoutTest1 : public Test {
private:
BButton* toggleRowButton;
BButton* toggleViewButton;
BView* toggledRow;
BGroupLayout* toggledRow;
TestView* toggledView;
};