Fixed #2252 (segmentation fault with enable=all)

This commit is contained in:
Robert Reif 2010-11-30 19:52:42 +01:00 committed by Daniel Marjamäki
parent f90236a183
commit 43dcc51752
2 changed files with 29 additions and 1 deletions

View File

@ -710,8 +710,20 @@ const Token *SymbolDatabase::initBaseInfo(SpaceInfo *info, const Token *tok)
// don't add unhandled templates
if (tok2->next()->str() == "<")
{
while (tok2->str() != ">")
int level1 = 1;
while (tok2->next())
{
if (tok2->next()->str() == ">")
{
level1--;
if (level == 0)
break;
}
else if (tok2->next()->str() == "<")
level1++;
tok2 = tok2->next();
}
}
// save pattern for base class name

View File

@ -173,6 +173,7 @@ private:
TEST_CASE(symboldatabase5); // ticket #2178
TEST_CASE(symboldatabase6); // ticket #2221
TEST_CASE(symboldatabase7); // ticket #2230
TEST_CASE(symboldatabase8); // ticket #2252
}
// Check the operator Equal
@ -4956,6 +4957,21 @@ private:
ASSERT_EQUALS("", errout.str());
}
void symboldatabase8()
{
// ticket #2252 - segmentation fault
checkConst("struct PaletteColorSpaceHolder: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>,\n"
" PaletteColorSpaceHolder>\n"
"{\n"
" uno::Reference<rendering::XColorSpace> operator()()\n"
" {\n"
" return vcl::unotools::createStandardColorSpace();\n"
" }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestClass)