From 6262418e6a1d929934bf4c9828c0b6e489286fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 14 Jun 2005 00:12:45 +0000 Subject: [PATCH] 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 --- src/servers/app/ServerBitmap.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/servers/app/ServerBitmap.cpp b/src/servers/app/ServerBitmap.cpp index cf84ff0943..a80d82a218 100644 --- a/src/servers/app/ServerBitmap.cpp +++ b/src/servers/app/ServerBitmap.cpp @@ -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 // copy of this software and associated documentation files (the "Software"), @@ -103,7 +103,14 @@ ServerBitmap::_AllocateBuffer(void) uint32 length = BitsLength(); if (length > 0) { 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; + } } }