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:
Stefano Ceccherini
2009-08-15 13:12:10 +00:00
parent 5af0dbf3ca
commit 701dae79c9
3 changed files with 17 additions and 4 deletions
+6 -4
View File
@@ -675,6 +675,11 @@ ServerWindow::_CreateView(BPrivate::LinkReceiver& link, View** _parent)
if (newView == NULL)
return NULL;
if (newView->InitCheck() != B_OK) {
delete newView;
return NULL;
}
// there is no way of setting this, other than manually :-)
newView->SetViewColor(viewColor);
newView->SetHidden(hidden);
@@ -1292,10 +1297,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
}
default:
// TODO: when creating a View, check for yet non-existing
// View::InitCheck() and take appropriate actions, then checking
// for fCurrentView->CurrentState() is unnecessary
if (fCurrentView == NULL || fCurrentView->CurrentState() == NULL) {
if (fCurrentView == NULL) {
BString codeName;
string_for_message_code(code, codeName);
debug_printf("ServerWindow %s received unexpected code - "
+10
View File
@@ -149,6 +149,16 @@ View::~View()
}
status_t
View::InitCheck() const
{
if (fDrawState == NULL)
return B_NO_MEMORY;
return B_OK;
}
IntRect
View::Bounds() const
{
+1
View File
@@ -42,6 +42,7 @@ class View {
const char* name, int32 token,
uint32 resizeMode, uint32 flags);
virtual ~View();
status_t InitCheck() const;
int32 Token() const
{ return fToken; }