[BUG_FIXD] Fix a crash bug of dockable dialog due to optimization of loop.

[ENHANCEMENT] functionList.xml will be copied in the %appdata%\notepad++\ if doLocalConf.xml is not present.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1063 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-06-29 18:53:01 +00:00
parent 5ae6536ce5
commit 32c6a0b393
2 changed files with 36 additions and 4 deletions

View File

@ -154,7 +154,8 @@ tTbData* DockingCont::createToolbar(tTbData data)
void DockingCont::removeToolbar(tTbData TbData)
{
// remove from list
for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++)
// items in _vTbData are removed in the loop so _vTbData.size() should be checked in every iteration
for (size_t iTb = 0 ; iTb < _vTbData.size(); iTb++)
{
if (_vTbData[iTb]->hClient == TbData.hClient)
{

View File

@ -241,11 +241,42 @@ void FunctionListPanel::reload()
void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView)
{
DockingDlgInterface::init(hInst, hPere);
_ppEditView = ppEditView;
DockingDlgInterface::init(hInst, hPere);
_ppEditView = ppEditView;
bool isOK = false;
bool doLocalConf = (NppParameters::getInstance())->isLocal();
if (!doLocalConf)
{
generic_string funcListXmlPath = (NppParameters::getInstance())->getUserPath();
PathAppend(funcListXmlPath, TEXT("functionList.xml"));
_funcParserMgr.init(funcListXmlPath, ppEditView);
if (!PathFileExists(funcListXmlPath.c_str()))
{
generic_string funcListDefaultXmlPath = (NppParameters::getInstance())->getNppPath();
PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml"));
if (PathFileExists(funcListDefaultXmlPath.c_str()))
{
::CopyFile(funcListDefaultXmlPath.c_str(), funcListXmlPath.c_str(), TRUE);
isOK = _funcParserMgr.init(funcListXmlPath, ppEditView);
}
}
else
{
isOK = _funcParserMgr.init(funcListXmlPath, ppEditView);
}
}
else
{
generic_string funcListDefaultXmlPath = (NppParameters::getInstance())->getNppPath();
PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml"));
if (PathFileExists(funcListDefaultXmlPath.c_str()))
{
isOK = _funcParserMgr.init(funcListDefaultXmlPath, ppEditView);
}
}
//return isOK;
}
bool FunctionListPanel::openSelection()