From 5ff090465d2f7f3166760f1624a742aefea0ab74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 6 Jun 2011 20:34:52 +0000 Subject: [PATCH] * 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 --- src/kits/app/Jamfile | 4 +++- src/kits/app/ServerMemoryAllocator.cpp | 18 +++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/kits/app/Jamfile b/src/kits/app/Jamfile index cf85c79fa9..78c6a812d1 100644 --- a/src/kits/app/Jamfile +++ b/src/kits/app/Jamfile @@ -34,6 +34,8 @@ MergeObject app_kit.o : Handler.cpp InitTerminateLibBe.cpp Invoker.cpp + Key.cpp + KeyStore.cpp LinkReceiver.cpp LinkSender.cpp Looper.cpp @@ -55,6 +57,6 @@ MergeObject app_kit.o : ServerLink.cpp ServerMemoryAllocator.cpp TokenSpace.cpp - TypeConstants.cpp + TypeConstants.cpp ; diff --git a/src/kits/app/ServerMemoryAllocator.cpp b/src/kits/app/ServerMemoryAllocator.cpp index 5235f67819..31e4961d20 100644 --- a/src/kits/app/ServerMemoryAllocator.cpp +++ b/src/kits/app/ServerMemoryAllocator.cpp @@ -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 + #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST # include #endif -#include - 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