app_server: detach client allocator on quit.
* This prevents sending out notification to applications that are already gone, and should thus fix #9116 according to John.
This commit is contained in:
parent
a9abcc37cd
commit
4f96ace6d5
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2013, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -66,6 +66,10 @@ ClientMemoryAllocator::~ClientMemoryAllocator()
|
||||
void*
|
||||
ClientMemoryAllocator::Allocate(size_t size, block** _address, bool& newArea)
|
||||
{
|
||||
// A detached allocator no longer allows any further allocations
|
||||
if (fApplication == NULL)
|
||||
return NULL;
|
||||
|
||||
BAutolock locker(fLock);
|
||||
|
||||
// Search best matching free block from the list
|
||||
@ -179,18 +183,30 @@ ClientMemoryAllocator::Free(block* freeBlock)
|
||||
|
||||
fChunks.Remove(chunk);
|
||||
delete_area(chunk->area);
|
||||
fApplication->NotifyDeleteClientArea(chunk->area);
|
||||
|
||||
if (fApplication != NULL)
|
||||
fApplication->NotifyDeleteClientArea(chunk->area);
|
||||
|
||||
free(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientMemoryAllocator::Detach()
|
||||
{
|
||||
BAutolock locker(fLock);
|
||||
fApplication = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientMemoryAllocator::Dump()
|
||||
{
|
||||
debug_printf("Application %" B_PRId32 ", %s: chunks:\n",
|
||||
fApplication->ClientTeam(), fApplication->Signature());
|
||||
if (fApplication != NULL) {
|
||||
debug_printf("Application %" B_PRId32 ", %s: chunks:\n",
|
||||
fApplication->ClientTeam(), fApplication->Signature());
|
||||
}
|
||||
|
||||
chunk_list::Iterator iterator = fChunks.GetIterator();
|
||||
int32 i = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2013, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -43,6 +43,8 @@ public:
|
||||
bool& newArea);
|
||||
void Free(block* cookie);
|
||||
|
||||
void Detach();
|
||||
|
||||
void Dump();
|
||||
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2012, Haiku.
|
||||
* Copyright 2001-2013, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -192,6 +192,7 @@ ServerApp::~ServerApp()
|
||||
fWindowListLock.Lock();
|
||||
}
|
||||
|
||||
fMemoryAllocator.Detach();
|
||||
fMapLocker.Lock();
|
||||
|
||||
while (!fBitmapMap.empty())
|
||||
|
Loading…
Reference in New Issue
Block a user