Squashed a TODO: Added a View::InitCheck() and use it after construction. Removed the check
for View->CurrentState() == NULL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32412 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -675,6 +675,11 @@ ServerWindow::_CreateView(BPrivate::LinkReceiver& link, View** _parent)
|
|||||||
if (newView == NULL)
|
if (newView == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (newView->InitCheck() != B_OK) {
|
||||||
|
delete newView;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// there is no way of setting this, other than manually :-)
|
// there is no way of setting this, other than manually :-)
|
||||||
newView->SetViewColor(viewColor);
|
newView->SetViewColor(viewColor);
|
||||||
newView->SetHidden(hidden);
|
newView->SetHidden(hidden);
|
||||||
@@ -1292,10 +1297,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO: when creating a View, check for yet non-existing
|
if (fCurrentView == NULL) {
|
||||||
// View::InitCheck() and take appropriate actions, then checking
|
|
||||||
// for fCurrentView->CurrentState() is unnecessary
|
|
||||||
if (fCurrentView == NULL || fCurrentView->CurrentState() == NULL) {
|
|
||||||
BString codeName;
|
BString codeName;
|
||||||
string_for_message_code(code, codeName);
|
string_for_message_code(code, codeName);
|
||||||
debug_printf("ServerWindow %s received unexpected code - "
|
debug_printf("ServerWindow %s received unexpected code - "
|
||||||
|
|||||||
@@ -149,6 +149,16 @@ View::~View()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
View::InitCheck() const
|
||||||
|
{
|
||||||
|
if (fDrawState == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IntRect
|
IntRect
|
||||||
View::Bounds() const
|
View::Bounds() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class View {
|
|||||||
const char* name, int32 token,
|
const char* name, int32 token,
|
||||||
uint32 resizeMode, uint32 flags);
|
uint32 resizeMode, uint32 flags);
|
||||||
virtual ~View();
|
virtual ~View();
|
||||||
|
status_t InitCheck() const;
|
||||||
|
|
||||||
int32 Token() const
|
int32 Token() const
|
||||||
{ return fToken; }
|
{ return fToken; }
|
||||||
|
|||||||
Reference in New Issue
Block a user