fInitialized was never set to "true", so InitCheck() could never succeed.
Also fixed _AllocateBuffer() to handle out of memory situations gracefully. It should probably also have upper limits with regard to the bitmap size. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13109 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -103,7 +103,14 @@ ServerBitmap::_AllocateBuffer(void)
|
|||||||
uint32 length = BitsLength();
|
uint32 length = BitsLength();
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
delete[] fBuffer;
|
delete[] fBuffer;
|
||||||
fBuffer = new uint8[length];
|
try {
|
||||||
|
fBuffer = new uint8[length];
|
||||||
|
fInitialized = true;
|
||||||
|
} catch (...) {
|
||||||
|
// we can't do anything about it
|
||||||
|
fBuffer = NULL;
|
||||||
|
fInitialized = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user