a try fix for sh-2651: [crashhunters] Crash after google translate failure

and sh-2658: crash in LLPluginMessage::parse
Xiaohong Bao 2011-11-28 11:33:49 -07:00
parent 6f2894cee6
commit b0bae417ee
6 changed files with 24 additions and 18 deletions

View File

@ -34,9 +34,9 @@
//============================================================================
LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params)
{
LLXMLNode *ret = new LLXMLNode("profile", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE);
ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
@ -46,9 +46,9 @@ LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
}
LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params)
{
LLXMLNode *ret = new LLXMLNode("path", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE);
ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV);
@ -63,12 +63,15 @@ LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
}
LLXMLNode *LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
{
LLXMLNode *ret = new LLXMLNode("shape", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE);
exportPathParams(&params->getPathParams())->setParent(ret);
exportProfileParams(&params->getProfileParams())->setParent(ret);
LLPointer<LLXMLNode> node ;
node = exportPathParams(&params->getPathParams()) ;
node->setParent(ret);
node = exportProfileParams(&params->getProfileParams()) ;
node->setParent(ret);
return ret;
}

View File

@ -34,11 +34,11 @@
class LLVolumeXml
{
public:
static LLXMLNode* exportProfileParams(const LLProfileParams* params);
static LLPointer<LLXMLNode> exportProfileParams(const LLProfileParams* params);
static LLXMLNode* exportPathParams(const LLPathParams* params);
static LLPointer<LLXMLNode> exportPathParams(const LLPathParams* params);
static LLXMLNode* exportVolumeParams(const LLVolumeParams* params);
static LLPointer<LLXMLNode> exportVolumeParams(const LLVolumeParams* params);
};
#endif // LL_LLVOLUMEXML_H

View File

@ -1816,9 +1816,12 @@ void LLUI::setupPaths()
LLXMLNodePtr root;
BOOL success = LLXMLNode::parseFile(filename, root, NULL);
Paths paths;
LLXUIParser parser;
parser.readXUI(root, paths, filename);
if(success)
{
LLXUIParser parser;
parser.readXUI(root, paths, filename);
}
sXUIPaths.clear();
if (success && paths.validateBlock())

View File

@ -720,7 +720,7 @@ bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXML
LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (fp == NULL)
{
node = new LLXMLNode();
node = NULL ;
return false;
}
fseek(fp, 0, SEEK_END);
@ -780,7 +780,7 @@ bool LLXMLNode::parseBuffer(
{
llwarns << "Parse failure - wrong number of top-level nodes xml."
<< llendl;
node = new LLXMLNode();
node = NULL ;
return false;
}
@ -839,7 +839,7 @@ bool LLXMLNode::parseStream(
{
llwarns << "Parse failure - wrong number of top-level nodes xml."
<< llendl;
node = new LLXMLNode();
node = NULL;
return false;
}
@ -1240,7 +1240,7 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOO
{
return mDefault->getChild(name, node, FALSE);
}
node = new LLXMLNode();
node = NULL;
return false;
}

View File

@ -1125,6 +1125,7 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl
if( !file.isOpen() )
{
LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL;
XML_ParserFree( mParser );
return false;
}

View File

@ -7007,7 +7007,6 @@ void LLVivoxVoiceClient::captureBufferPlayStopSendMessage()
LLVivoxProtocolParser::LLVivoxProtocolParser()
{
parser = NULL;
parser = XML_ParserCreate(NULL);
reset();