Fix infinite loop bug, take 2
... by calling TBarView::UpdatePlacement() in
TBarWindow::FramedResized() only if the width has changed.
Explanation from take 1:
TBarWindow::FrameResized() calls TBarView::UpdatePlacement() to
resize the ExpandoMenuBar, however, UpdatePlacement() as part of its
work also resizes the window, which calls TBarWindow::FrameResized()
which in turn calls TBarView::UpdatePlacement() and so on.
To get out of this mess remove TBarView::UpdatePlacement() from
TBarWindow::FrameResized() but that leaves ExpandoMenuBar the
wrong size initially.
(now call UpdatePlacement() conditionally instead of removing it)
To fix this call SizeWindow() on AllAttached() which resizes
ExpandoMenuBar along with the rest of the window, but, just once not in
an infinite loop. Use AllAttached() rather than AttachedToWindow() so that
we are assured that ExpandoMenuBar and all of its children have been
attached thus avoiding the potential for an embarrasing Deskbar crash.
(we still need to call SizeWindow() on AllAttached())
Fixes #13706
This commit is contained in:
@@ -243,16 +243,18 @@ TBarWindow::FrameResized(float width, float height)
|
||||
else
|
||||
newWidth = width;
|
||||
|
||||
float oldWidth = static_cast<TBarApp*>(be_app)->Settings()->width;
|
||||
|
||||
// update width setting
|
||||
static_cast<TBarApp*>(be_app)->Settings()->width = newWidth;
|
||||
}
|
||||
|
||||
if (Lock()) {
|
||||
fBarView->ResizeTo(width, fBarView->Bounds().Height());
|
||||
if (fBarView->Vertical() && fBarView->ExpandoState())
|
||||
fBarView->ExpandoMenuBar()->SetMaxContentWidth(width);
|
||||
if (oldWidth != newWidth) {
|
||||
fBarView->ResizeTo(width, fBarView->Bounds().Height());
|
||||
if (fBarView->Vertical() && fBarView->ExpandoState())
|
||||
fBarView->ExpandoMenuBar()->SetMaxContentWidth(width);
|
||||
|
||||
Unlock();
|
||||
fBarView->UpdatePlacement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user