BWindow: lock the looper in some new methods.

* This makes it more convenient to call them from someplace else, and
  follows the design used in the rest of the implementation.
This commit is contained in:
Axel Dörfler 2015-11-16 20:20:37 +01:00
parent 67c3eeebdc
commit 670cfb15a5

View File

@ -1549,6 +1549,8 @@ BWindow::GetSizeLimits(float* _minWidth, float* _maxWidth, float* _minHeight,
void
BWindow::UpdateSizeLimits()
{
BAutolock locker(this);
if ((fFlags & B_AUTO_UPDATE_SIZE_LIMITS) != 0) {
// Get min/max constraints of the top view and enforce window
// size limits respectively.
@ -2524,6 +2526,7 @@ BWindow::ResizeTo(float width, float height)
void
BWindow::ResizeToPreferred()
{
BAutolock locker(this);
Layout(false);
float width = fTopView->PreferredSize().width;
@ -2544,6 +2547,8 @@ BWindow::ResizeToPreferred()
void
BWindow::CenterIn(const BRect& rect)
{
BAutolock locker(this);
// Set size limits now if needed
UpdateSizeLimits();