summaryrefslogtreecommitdiff
path: root/indra/llxuixml
diff options
context:
space:
mode:
authorRichard Nelson <none@none>2010-08-16 14:59:06 -0700
committerRichard Nelson <none@none>2010-08-16 14:59:06 -0700
commit1fe2cb24f4288840fd682cae8274c193d66a1886 (patch)
tree0c9c4de5fb6f6b3b4032ae2499293347d5af6975 /indra/llxuixml
parent720b29b1b42fb16ecff835bc1a103bc66499ab94 (diff)
fixed slicing problem with paramblocks where block descriptors are invalid after copying a derived block type to a base block value.
Diffstat (limited to 'indra/llxuixml')
-rw-r--r--indra/llxuixml/llinitparam.cpp5
-rw-r--r--indra/llxuixml/llinitparam.h13
2 files changed, 10 insertions, 8 deletions
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp
index 8d6aa405e2..99191d2dbe 100644
--- a/indra/llxuixml/llinitparam.cpp
+++ b/indra/llxuixml/llinitparam.cpp
@@ -84,8 +84,7 @@ namespace LLInitParam
// BaseBlock
//
BaseBlock::BaseBlock()
- : mChangeVersion(0),
- mBlockDescriptor(NULL)
+ : mChangeVersion(0)
{}
BaseBlock::~BaseBlock()
@@ -94,8 +93,6 @@ namespace LLInitParam
// called by each derived class in least to most derived order
void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size)
{
- mBlockDescriptor = &descriptor;
-
descriptor.mCurrentBlockPtr = this;
descriptor.mMaxParamOffset = block_size;
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index 9890bacea4..5461ad9d05 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -480,8 +480,8 @@ namespace LLInitParam
bool serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const;
bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t()) const;
- const BlockDescriptor& mostDerivedBlockDescriptor() const { return *mBlockDescriptor; }
- BlockDescriptor& mostDerivedBlockDescriptor() { return *mBlockDescriptor; }
+ virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
+ virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); }
// take all provided params from other and apply to self
bool overwriteFrom(const BaseBlock& other)
@@ -506,8 +506,6 @@ namespace LLInitParam
// can be updated in getters
mutable S32 mChangeVersion;
- BlockDescriptor* mBlockDescriptor; // most derived block descriptor
-
static BlockDescriptor& selfBlockDescriptor()
{
static BlockDescriptor sBlockDescriptor;
@@ -1313,6 +1311,9 @@ namespace LLInitParam
BaseBlock::setLastChangedParam(last_param, user_provided);
}
+ virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
+ virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); }
+
protected:
Choice()
: mCurChoice(0)
@@ -1422,6 +1423,10 @@ namespace LLInitParam
{
return BaseBlock::merge(selfBlockDescriptor(), other, false);
}
+
+ virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
+ virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); }
+
protected:
Block()
{