Skip to content
Snippets Groups Projects
Commit 1fe2cb24 authored by Richard Nelson's avatar Richard Nelson
Browse files

fixed slicing problem with paramblocks where block descriptors are invalid...

fixed slicing problem with paramblocks where block descriptors are invalid after copying a derived block type to a base block value.
parent 720b29b1
No related branches found
No related tags found
No related merge requests found
...@@ -84,8 +84,7 @@ namespace LLInitParam ...@@ -84,8 +84,7 @@ namespace LLInitParam
// BaseBlock // BaseBlock
// //
BaseBlock::BaseBlock() BaseBlock::BaseBlock()
: mChangeVersion(0), : mChangeVersion(0)
mBlockDescriptor(NULL)
{} {}
BaseBlock::~BaseBlock() BaseBlock::~BaseBlock()
...@@ -94,8 +93,6 @@ namespace LLInitParam ...@@ -94,8 +93,6 @@ namespace LLInitParam
// called by each derived class in least to most derived order // called by each derived class in least to most derived order
void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size) void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size)
{ {
mBlockDescriptor = &descriptor;
descriptor.mCurrentBlockPtr = this; descriptor.mCurrentBlockPtr = this;
descriptor.mMaxParamOffset = block_size; descriptor.mMaxParamOffset = block_size;
......
...@@ -480,8 +480,8 @@ namespace LLInitParam ...@@ -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 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; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t()) const;
const BlockDescriptor& mostDerivedBlockDescriptor() const { return *mBlockDescriptor; } virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
BlockDescriptor& mostDerivedBlockDescriptor() { return *mBlockDescriptor; } virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); }
// take all provided params from other and apply to self // take all provided params from other and apply to self
bool overwriteFrom(const BaseBlock& other) bool overwriteFrom(const BaseBlock& other)
...@@ -506,8 +506,6 @@ namespace LLInitParam ...@@ -506,8 +506,6 @@ namespace LLInitParam
// can be updated in getters // can be updated in getters
mutable S32 mChangeVersion; mutable S32 mChangeVersion;
BlockDescriptor* mBlockDescriptor; // most derived block descriptor
static BlockDescriptor& selfBlockDescriptor() static BlockDescriptor& selfBlockDescriptor()
{ {
static BlockDescriptor sBlockDescriptor; static BlockDescriptor sBlockDescriptor;
...@@ -1313,6 +1311,9 @@ namespace LLInitParam ...@@ -1313,6 +1311,9 @@ namespace LLInitParam
BaseBlock::setLastChangedParam(last_param, user_provided); BaseBlock::setLastChangedParam(last_param, user_provided);
} }
virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); }
protected: protected:
Choice() Choice()
: mCurChoice(0) : mCurChoice(0)
...@@ -1422,6 +1423,10 @@ namespace LLInitParam ...@@ -1422,6 +1423,10 @@ namespace LLInitParam
{ {
return BaseBlock::merge(selfBlockDescriptor(), other, false); return BaseBlock::merge(selfBlockDescriptor(), other, false);
} }
virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); }
protected: protected:
Block() Block()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment