* ServerMemoryAllocator::RemoveArea() never removed the deleted mapping from

the list.
* Might even help with #7632.
+alpha


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41983 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-06-06 20:34:52 +00:00
parent dae8628f1b
commit 5ff090465d
2 changed files with 14 additions and 8 deletions

View File

@ -34,6 +34,8 @@ MergeObject <libbe>app_kit.o :
Handler.cpp
InitTerminateLibBe.cpp
Invoker.cpp
Key.cpp
KeyStore.cpp
LinkReceiver.cpp
LinkSender.cpp
Looper.cpp
@ -55,6 +57,6 @@ MergeObject <libbe>app_kit.o :
ServerLink.cpp
ServerMemoryAllocator.cpp
TokenSpace.cpp
TypeConstants.cpp
TypeConstants.cpp
;

View File

@ -1,11 +1,12 @@
/*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
/*! Note, this class don't provide any locking whatsoever - you are
supposed to have a BPrivate::AppServerLink object around which
does the necessary locking.
@ -13,17 +14,19 @@
take care for yourself!
*/
#include "ServerMemoryAllocator.h"
#include <new>
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
# include <syscalls.h>
#endif
#include <new>
namespace BPrivate {
struct area_mapping {
area_id server_area;
area_id local_area;
@ -57,8 +60,8 @@ ServerMemoryAllocator::InitCheck()
status_t
ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base,
bool readOnly)
ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area,
uint8*& _base, bool readOnly)
{
area_mapping* mapping = new (std::nothrow) area_mapping;
if (mapping == NULL || !fAreas.AddItem(mapping)) {
@ -80,8 +83,7 @@ ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base
#endif
mapping->local_area = clone_area(readOnly
? "server read-only memory" : "server_memory",
&base, addressSpec,
? "server read-only memory" : "server_memory", &base, addressSpec,
B_READ_AREA | (readOnly ? 0 : B_WRITE_AREA), serverArea);
if (mapping->local_area < B_OK) {
status = mapping->local_area;
@ -112,6 +114,7 @@ ServerMemoryAllocator::RemoveArea(area_id serverArea)
// we found the area we should remove
delete_area(mapping->local_area);
delete mapping;
fAreas.RemoveItem(i);
break;
}
}
@ -135,4 +138,5 @@ ServerMemoryAllocator::AreaAndBaseFor(area_id serverArea, area_id& _area,
return B_ERROR;
}
} // namespace BPrivate