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