BView::AdoptViewColors: handle not yet attached to a Window.

As per API documentation, a BView caches the configured view
colours when not yet attached to the app_server via its
window. So check if we're attached to a window, and if we are,
then and only then do we attempt to lock/unlock our looper.

This fixes uses of AdoptViewColors and AdoptParentColors when
the view isn't yet attached to a window.
This commit is contained in:
Jessica Hamilton 2016-01-10 17:41:06 +13:00
parent 1150f8cbd4
commit ed749c6221

View File

@ -2609,7 +2609,7 @@ BView::AdoptSystemColors()
void
BView::AdoptViewColors(BView* view)
{
if (view == NULL || !view->LockLooper())
if (view == NULL || (view->Window() != NULL && !view->LockLooper()))
return;
float tint = B_NO_TINT;
@ -2638,7 +2638,8 @@ BView::AdoptViewColors(BView* view)
else
SetHighColor(view->HighColor());
view->UnlockLooper();
if (view->Window() != NULL)
view->UnlockLooper();
}