From ed749c6221a6d4449ed644a8550e96e49ed8ae86 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Sun, 10 Jan 2016 17:41:06 +1300 Subject: [PATCH] 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. --- src/kits/interface/View.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 21b563f1c0..cf03b8fad2 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -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(); }