* Fixed a bug in ServerApp: when a ServerWindow would take too long to quit,
it could crashed the server. * ViewLayer now deletes the view bitmap on destruction, if any. * BitmapManager::Delete() now also accepts NULL bitmaps. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15723 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -113,7 +113,7 @@ BitmapManager::CreateBitmap(BRect bounds, color_space space, int32 flags,
|
|||||||
void
|
void
|
||||||
BitmapManager::DeleteBitmap(ServerBitmap *bitmap)
|
BitmapManager::DeleteBitmap(ServerBitmap *bitmap)
|
||||||
{
|
{
|
||||||
if (!bitmap->_Release()) {
|
if (bitmap == NULL || !bitmap->_Release()) {
|
||||||
// there are other references to this bitmap, we don't have to delete it yet
|
// there are other references to this bitmap, we don't have to delete it yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,14 @@ ServerApp::~ServerApp()
|
|||||||
|
|
||||||
fWindowListLock.Lock();
|
fWindowListLock.Lock();
|
||||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||||
sem_id deathSemaphore = fWindowList.ItemAt(i)->DeathSemaphore();
|
ServerWindow* window = fWindowList.ItemAt(i);
|
||||||
|
|
||||||
|
// a window could have been remove in the mean time (if those 20 millisecs
|
||||||
|
// from above weren't enough)
|
||||||
|
if (window == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sem_id deathSemaphore = window->DeathSemaphore();
|
||||||
fWindowListLock.Unlock();
|
fWindowListLock.Unlock();
|
||||||
|
|
||||||
// wait 3 seconds for our window to quit - that's quite a long
|
// wait 3 seconds for our window to quit - that's quite a long
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ ViewLayer::ViewLayer(BRect frame, const char* name,
|
|||||||
// destructor
|
// destructor
|
||||||
ViewLayer::~ViewLayer()
|
ViewLayer::~ViewLayer()
|
||||||
{
|
{
|
||||||
|
if (fViewBitmap != NULL)
|
||||||
|
gBitmapManager->DeleteBitmap(fViewBitmap);
|
||||||
|
|
||||||
delete fDrawState;
|
delete fDrawState;
|
||||||
|
|
||||||
// iterate over children and delete each one
|
// iterate over children and delete each one
|
||||||
|
|||||||
Reference in New Issue
Block a user