Fixed bug #1028 from both sides:
* FindPanel::SetUpAddRemoveButtons() called Window()->FindView() but did not check if Window() was NULL. * BWindow now always checks the result of a BAutolock - this is why Tracker got away with this bug on BeOS; NULL windows cannot be locked... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22102 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -503,7 +503,8 @@ void
|
|||||||
BWindow::AddChild(BView *child, BView *before)
|
BWindow::AddChild(BView *child, BView *before)
|
||||||
{
|
{
|
||||||
BAutolock locker(this);
|
BAutolock locker(this);
|
||||||
fTopView->AddChild(child, before);
|
if (locker.IsLocked())
|
||||||
|
fTopView->AddChild(child, before);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -511,6 +512,9 @@ bool
|
|||||||
BWindow::RemoveChild(BView *child)
|
BWindow::RemoveChild(BView *child)
|
||||||
{
|
{
|
||||||
BAutolock locker(this);
|
BAutolock locker(this);
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return false;
|
||||||
|
|
||||||
return fTopView->RemoveChild(child);
|
return fTopView->RemoveChild(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,7 +522,10 @@ BWindow::RemoveChild(BView *child)
|
|||||||
int32
|
int32
|
||||||
BWindow::CountChildren() const
|
BWindow::CountChildren() const
|
||||||
{
|
{
|
||||||
BAutolock _(const_cast<BWindow*>(this));
|
BAutolock locker(const_cast<BWindow*>(this));
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return 0;
|
||||||
|
|
||||||
return fTopView->CountChildren();
|
return fTopView->CountChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +533,10 @@ BWindow::CountChildren() const
|
|||||||
BView *
|
BView *
|
||||||
BWindow::ChildAt(int32 index) const
|
BWindow::ChildAt(int32 index) const
|
||||||
{
|
{
|
||||||
BAutolock _(const_cast<BWindow*>(this));
|
BAutolock locker(const_cast<BWindow*>(this));
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return fTopView->ChildAt(index);
|
return fTopView->ChildAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1673,7 +1683,10 @@ BWindow::UpdateIfNeeded()
|
|||||||
BView *
|
BView *
|
||||||
BWindow::FindView(const char *viewName) const
|
BWindow::FindView(const char *viewName) const
|
||||||
{
|
{
|
||||||
BAutolock _(const_cast<BWindow*>(this));
|
BAutolock locker(const_cast<BWindow*>(this));
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return fTopView->FindView(viewName);
|
return fTopView->FindView(viewName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1681,7 +1694,10 @@ BWindow::FindView(const char *viewName) const
|
|||||||
BView *
|
BView *
|
||||||
BWindow::FindView(BPoint point) const
|
BWindow::FindView(BPoint point) const
|
||||||
{
|
{
|
||||||
BAutolock _(const_cast<BWindow*>(this));
|
BAutolock locker(const_cast<BWindow*>(this));
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
// point is assumed to be in window coordinates,
|
// point is assumed to be in window coordinates,
|
||||||
// fTopView has same bounds as window
|
// fTopView has same bounds as window
|
||||||
return _FindView(fTopView, point);
|
return _FindView(fTopView, point);
|
||||||
@@ -1946,6 +1962,8 @@ status_t
|
|||||||
BWindow::SetLook(window_look look)
|
BWindow::SetLook(window_look look)
|
||||||
{
|
{
|
||||||
BAutolock locker(this);
|
BAutolock locker(this);
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
fLink->StartMessage(AS_SET_LOOK);
|
fLink->StartMessage(AS_SET_LOOK);
|
||||||
fLink->Attach<int32>((int32)look);
|
fLink->Attach<int32>((int32)look);
|
||||||
@@ -1972,6 +1990,8 @@ status_t
|
|||||||
BWindow::SetFeel(window_feel feel)
|
BWindow::SetFeel(window_feel feel)
|
||||||
{
|
{
|
||||||
BAutolock locker(this);
|
BAutolock locker(this);
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
fLink->StartMessage(AS_SET_FEEL);
|
fLink->StartMessage(AS_SET_FEEL);
|
||||||
fLink->Attach<int32>((int32)feel);
|
fLink->Attach<int32>((int32)feel);
|
||||||
@@ -1995,6 +2015,8 @@ status_t
|
|||||||
BWindow::SetFlags(uint32 flags)
|
BWindow::SetFlags(uint32 flags)
|
||||||
{
|
{
|
||||||
BAutolock locker(this);
|
BAutolock locker(this);
|
||||||
|
if (!locker.IsLocked())
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
fLink->StartMessage(AS_SET_FLAGS);
|
fLink->StartMessage(AS_SET_FLAGS);
|
||||||
fLink->Attach<uint32>(flags);
|
fLink->Attach<uint32>(flags);
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ const char *kAllMimeTypes = "mime/ALLTYPES";
|
|||||||
const BRect kInitialRect(100, 100, 530, 210);
|
const BRect kInitialRect(100, 100, 530, 210);
|
||||||
const int32 kInitialAttrModeWindowHeight = 140;
|
const int32 kInitialAttrModeWindowHeight = 140;
|
||||||
const int32 kIncrementPerAttribute = 30;
|
const int32 kIncrementPerAttribute = 30;
|
||||||
|
const float kMoreOptionsDelta = 20;
|
||||||
|
|
||||||
const uint32 kMoreOptionsMessage = 'mrop';
|
const uint32 kMoreOptionsMessage = 'mrop';
|
||||||
const uint32 kNameModifiedMessage = 'nmmd';
|
const uint32 kNameModifiedMessage = 'nmmd';
|
||||||
@@ -639,7 +640,6 @@ FindWindow::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
const float kMoreOptionsDelta = 20;
|
|
||||||
|
|
||||||
FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
|
FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
|
||||||
bool , bool editTemplateOnly)
|
bool , bool editTemplateOnly)
|
||||||
@@ -1830,8 +1830,10 @@ FindPanel::AddOneAttributeItem(BBox *box, BRect rect)
|
|||||||
void
|
void
|
||||||
FindPanel::SetUpAddRemoveButtons(BBox *box)
|
FindPanel::SetUpAddRemoveButtons(BBox *box)
|
||||||
{
|
{
|
||||||
BButton *button = dynamic_cast<BButton *>(Window()->FindView("remove"));
|
BButton *button = Window() != NULL
|
||||||
if (!button) {
|
? dynamic_cast<BButton *>(Window()->FindView("remove"))
|
||||||
|
: NULL;
|
||||||
|
if (button == NULL) {
|
||||||
BRect rect = box->Bounds();
|
BRect rect = box->Bounds();
|
||||||
rect.InsetBy(5, 10);
|
rect.InsetBy(5, 10);
|
||||||
rect.top = rect.bottom - 20;
|
rect.top = rect.bottom - 20;
|
||||||
|
|||||||
Reference in New Issue
Block a user