[BUG_FIXED] Fix crash issue due to themes switching.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@645 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-07-31 22:32:42 +00:00
parent 4eeff970ab
commit 9400d01219

View File

@ -163,15 +163,18 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
// Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name.
generic_string themeDir(pNppParams->getAppDataNppDir());
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
generic_string themeDir;
if (pNppParams->getAppDataNppDir() && pNppParams->getAppDataNppDir()[0])
{
themeDir = pNppParams->getAppDataNppDir();
PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
}
fileNames.clear();
themeDir.clear();
themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy