BBox: tolerate non-layouted child in layouted mode
While mixing layouted and non-layouted views is not supported, we are doing it in some cases, including translator preferences (which uses layout, but the views may come from a translator add-on which doesn't). So, try to handle that case and at least avoid crashes by calling MinSize/MaxSize and other unsupported layout code on views which won't handle it. Fixes #12610.
This commit is contained in:
@@ -592,14 +592,18 @@ BBox::DoLayout()
|
||||
return;
|
||||
|
||||
// layout the child
|
||||
if (BView* child = _Child()) {
|
||||
BView* child = _Child();
|
||||
if (child) {
|
||||
BRect frame(Bounds());
|
||||
frame.left += fLayoutData->insets.left;
|
||||
frame.top += fLayoutData->insets.top;
|
||||
frame.right -= fLayoutData->insets.right;
|
||||
frame.bottom -= fLayoutData->insets.bottom;
|
||||
|
||||
BLayoutUtils::AlignInFrame(child, frame);
|
||||
if (child->Flags() & B_SUPPORTS_LAYOUT)
|
||||
BLayoutUtils::AlignInFrame(child, frame);
|
||||
else
|
||||
child->MoveTo(frame.LeftTop());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,7 +859,7 @@ BBox::_ValidateLayoutData()
|
||||
|
||||
// finally consider the child constraints, if we shall support layout
|
||||
BView* child = _Child();
|
||||
if (child && (Flags() & B_SUPPORTS_LAYOUT)) {
|
||||
if (child && (child->Flags() & B_SUPPORTS_LAYOUT)) {
|
||||
BSize min = child->MinSize();
|
||||
BSize max = child->MaxSize();
|
||||
BSize preferred = child->PreferredSize();
|
||||
|
||||
Reference in New Issue
Block a user