hrev50053 adds 1 changeset to branch 'master'
old head: 37f9a29216ef9d2eb82476acca50f70df6d950e4
new head: be1537b41ae3ec2ddab1e819aa80f02ecabda5d9
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=be1537b41ae3+%5E37f9a29216ef
----------------------------------------------------------------------------
be1537b41ae3: 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.
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev50053
Commit: be1537b41ae3ec2ddab1e819aa80f02ecabda5d9
URL: http://cgit.haiku-os.org/haiku/commit/?id=be1537b41ae3
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sun Jan 24 12:42:11 2016 UTC
Ticket: https://dev.haiku-os.org/ticket/12610
----------------------------------------------------------------------------
1 file changed, 7 insertions(+), 3 deletions(-)
src/kits/interface/Box.cpp | 10 +++++++---
----------------------------------------------------------------------------
diff --git a/src/kits/interface/Box.cpp b/src/kits/interface/Box.cpp
index fe0a395..0b0cb82 100644
--- a/src/kits/interface/Box.cpp
+++ b/src/kits/interface/Box.cpp
@@ -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();