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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -66,6 +66,10 @@ ClientMemoryAllocator::~ClientMemoryAllocator()
|
||||||
void*
|
void*
|
||||||
ClientMemoryAllocator::Allocate(size_t size, block** _address, bool& newArea)
|
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);
|
BAutolock locker(fLock);
|
||||||
|
|
||||||
// Search best matching free block from the list
|
// Search best matching free block from the list
|
||||||
|
@ -179,18 +183,30 @@ ClientMemoryAllocator::Free(block* freeBlock)
|
||||||
|
|
||||||
fChunks.Remove(chunk);
|
fChunks.Remove(chunk);
|
||||||
delete_area(chunk->area);
|
delete_area(chunk->area);
|
||||||
fApplication->NotifyDeleteClientArea(chunk->area);
|
|
||||||
|
if (fApplication != NULL)
|
||||||
|
fApplication->NotifyDeleteClientArea(chunk->area);
|
||||||
|
|
||||||
free(chunk);
|
free(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientMemoryAllocator::Detach()
|
||||||
|
{
|
||||||
|
BAutolock locker(fLock);
|
||||||
|
fApplication = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientMemoryAllocator::Dump()
|
ClientMemoryAllocator::Dump()
|
||||||
{
|
{
|
||||||
debug_printf("Application %" B_PRId32 ", %s: chunks:\n",
|
if (fApplication != NULL) {
|
||||||
fApplication->ClientTeam(), fApplication->Signature());
|
debug_printf("Application %" B_PRId32 ", %s: chunks:\n",
|
||||||
|
fApplication->ClientTeam(), fApplication->Signature());
|
||||||
|
}
|
||||||
|
|
||||||
chunk_list::Iterator iterator = fChunks.GetIterator();
|
chunk_list::Iterator iterator = fChunks.GetIterator();
|
||||||
int32 i = 0;
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -43,6 +43,8 @@ public:
|
||||||
bool& newArea);
|
bool& newArea);
|
||||||
void Free(block* cookie);
|
void Free(block* cookie);
|
||||||
|
|
||||||
|
void Detach();
|
||||||
|
|
||||||
void Dump();
|
void Dump();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2012, Haiku.
|
* Copyright 2001-2013, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -192,6 +192,7 @@ ServerApp::~ServerApp()
|
||||||
fWindowListLock.Lock();
|
fWindowListLock.Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fMemoryAllocator.Detach();
|
||||||
fMapLocker.Lock();
|
fMapLocker.Lock();
|
||||||
|
|
||||||
while (!fBitmapMap.empty())
|
while (!fBitmapMap.empty())
|
||||||
|
|
Loading…
Reference in New Issue