- FolderInfo.dll: Fixed several memory leaks

- Changed FolderInfo and WebParser to import pcre_* functions from Rainmeter.dll to reduce binary size
- Changed Help in context menu to open Support page (instead of Manual/Manual_beta)
This commit is contained in:
Birunthan Mohanathas
2012-02-04 08:25:11 +00:00
parent c790ca54e0
commit 1560c31510
9 changed files with 65 additions and 576 deletions

View File

@ -3,7 +3,7 @@
#include <list>
namespace PluginFolderInfo {
FolderInfo::FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath)
{
mySubFolderFlag = false;
@ -16,6 +16,11 @@ FolderInfo::FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath)
SetPath(aPath, aIniPath);
}
FolderInfo::~FolderInfo()
{
FreePcre();
}
void FolderInfo::Clear()
{
mySize = 0;
@ -23,6 +28,19 @@ void FolderInfo::Clear()
myFolderCount = 0;
}
void FolderInfo::FreePcre()
{
if (myRegExpFilter) {
pcre_free(myRegExpFilter);
myRegExpFilter = NULL;
}
if (myRegExpFilterExtra) {
pcre_free(myRegExpFilterExtra);
myRegExpFilterExtra = NULL;
}
}
void FolderInfo::SetPath(const wchar_t* aPath, const wchar_t* aIniPath)
{
if (!aPath || 0 == aPath[0]) {
@ -122,11 +140,7 @@ void FolderInfo::CalculateSize()
void FolderInfo::SetRegExpFilter(const wchar_t* aFilter)
{
if (myRegExpFilter) {
pcre_free(myRegExpFilter);
myRegExpFilter = NULL;
myRegExpFilterExtra = NULL;
}
FreePcre();
if (aFilter == NULL) {
return;
@ -144,6 +158,8 @@ void FolderInfo::SetRegExpFilter(const wchar_t* aFilter)
if (myRegExpFilter) {
myRegExpFilterExtra = pcre_study(myRegExpFilter, 0, &error);
}
delete [] buf;
}
} // namespace PluginFolderInfo