From 013e7894b73a3c58f2538be4f418c939553f98f5 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 18 Oct 2007 03:39:50 +0000 Subject: [PATCH] We need flags to track what properties of the partition change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22609 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/storage/MutablePartition.h | 4 ++++ .../storage/disk_device/MutablePartition.cpp | 22 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/headers/private/storage/MutablePartition.h b/headers/private/storage/MutablePartition.h index c4e3d9e24f..c473229b81 100644 --- a/headers/private/storage/MutablePartition.h +++ b/headers/private/storage/MutablePartition.h @@ -66,6 +66,9 @@ public: int32 CountChildren() const; int32 IndexOfChild(BMutablePartition* child) const; + void SetChangeFlags(uint32 flags); + uint32 ChangeFlags() const; + // for the partitioning system managing the parent void* ChildCookie() const; void SetChildCookie(void* cookie); @@ -89,6 +92,7 @@ private: user_partition_data* fData; BMutablePartition* fParent; BList fChildren; + uint32 fChangeFlags; void* fChildCookie; }; diff --git a/src/kits/storage/disk_device/MutablePartition.cpp b/src/kits/storage/disk_device/MutablePartition.cpp index d1bb57e0ab..a3f2fceeb0 100644 --- a/src/kits/storage/disk_device/MutablePartition.cpp +++ b/src/kits/storage/disk_device/MutablePartition.cpp @@ -321,7 +321,10 @@ BMutablePartition::DeleteChild(int32 index) if (!child) return B_BAD_VALUE; - delete child->fDelegate->Partition(); + // This will delete not only all delegates in the child's hierarchy, but + // also the respective partitions themselves, if they are no longer + // referenced. + child->fDelegate->Partition()->_DeleteDelegates(); return B_OK; } @@ -369,6 +372,22 @@ BMutablePartition::IndexOfChild(BMutablePartition* child) const } +// SetChangeFlags +void +BMutablePartition::SetChangeFlags(uint32 flags) +{ + fChangeFlags = flags; +} + + +// ChangeFlags +uint32 +BMutablePartition::ChangeFlags() const +{ + return fChangeFlags; +} + + // ChildCookie void* BMutablePartition::ChildCookie() const @@ -390,6 +409,7 @@ BMutablePartition::BMutablePartition(BPartition::Delegate* delegate) : fDelegate(delegate), fData(NULL), fParent(NULL), + fChangeFlags(0), fChildCookie(NULL) { }