Some old changes I forgot to commit... BInputServerDevice::InitCheck()
now checks if the fOwner allocation went fine (and returns B_NO_MEMORY in case it didn't). Since it can fail, inherited classes should call it as well (I modified MouseInputDevice's and KeyboardInputDevice's versions for now) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23106 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f6c512f8e3
commit
d246d9be88
@ -445,6 +445,10 @@ status_t
|
||||
KeyboardInputDevice::InitCheck()
|
||||
{
|
||||
CALLED();
|
||||
status_t status = BInputServerDevice::InitCheck();
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
// TODO: this doesn't belong here!
|
||||
_RecursiveScan(kKeyboardDevicesDirectory);
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
* Copyright 2004-2006, Haiku.
|
||||
* Copyright 2004-2007, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stefano Ceccherini
|
||||
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
|
||||
* Jérôme Duval
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
@ -97,7 +99,7 @@ LOG(const char *fmt, ...)
|
||||
extern "C" BInputServerDevice *
|
||||
instantiate_input_device()
|
||||
{
|
||||
return new MouseInputDevice();
|
||||
return new (std::nothrow) MouseInputDevice();
|
||||
}
|
||||
|
||||
|
||||
@ -443,7 +445,7 @@ status_t
|
||||
MouseInputDevice::InitCheck()
|
||||
{
|
||||
CALLED();
|
||||
return B_OK;
|
||||
return BInputServerDevice::InitCheck();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -8,10 +8,11 @@
|
||||
|
||||
#include <InputServerDevice.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
BInputServerDevice::BInputServerDevice()
|
||||
{
|
||||
fOwner = new _BDeviceAddOn_(this);
|
||||
fOwner = new (std::nothrow) _BDeviceAddOn_(this);
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +28,8 @@ BInputServerDevice::~BInputServerDevice()
|
||||
status_t
|
||||
BInputServerDevice::InitCheck()
|
||||
{
|
||||
if (fOwner == NULL)
|
||||
return B_NO_MEMORY;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user