fixes CID 455 Check for NULL and use std::nothrow
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27465 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include <InterfaceKit.h>
|
#include <InterfaceKit.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include "TeapotWindow.h"
|
#include "TeapotWindow.h"
|
||||||
|
|
||||||
@@ -34,9 +35,8 @@ TeapotWindow::TeapotWindow(BRect rect, char* name, window_type wt, ulong somethi
|
|||||||
AddChild(subView);
|
AddChild(subView);
|
||||||
|
|
||||||
bounds = subView->Bounds();
|
bounds = subView->Bounds();
|
||||||
fObjectView = new ObjectView(bounds, "objectView", B_FOLLOW_ALL_SIDES, type);
|
fObjectView = new(std::nothrow) ObjectView(bounds, "objectView", B_FOLLOW_ALL_SIDES, type);
|
||||||
subView->AddChild(fObjectView);
|
subView->AddChild(fObjectView);
|
||||||
fObjectView = fObjectView;
|
|
||||||
|
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
msg.AddInt32("num", 256);
|
msg.AddInt32("num", 256);
|
||||||
@@ -163,8 +163,9 @@ TeapotWindow::TeapotWindow(BRect rect, char* name, window_type wt, ulong somethi
|
|||||||
bool
|
bool
|
||||||
TeapotWindow::QuitRequested()
|
TeapotWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
// printf("closing \n");
|
if (fObjectView != NULL)
|
||||||
fObjectView->EnableDirectMode(false);
|
fObjectView->EnableDirectMode(false);
|
||||||
|
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -173,9 +174,10 @@ TeapotWindow::QuitRequested()
|
|||||||
void
|
void
|
||||||
TeapotWindow::DirectConnected(direct_buffer_info* info)
|
TeapotWindow::DirectConnected(direct_buffer_info* info)
|
||||||
{
|
{
|
||||||
if (fObjectView)
|
if (fObjectView != NULL) {
|
||||||
fObjectView->DirectConnected(info);
|
fObjectView->DirectConnected(info);
|
||||||
fObjectView->EnableDirectMode(true);
|
fObjectView->EnableDirectMode(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user