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