https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e554a359f34e35e403cb0…
commit e554a359f34e35e403cb0464032caf4258246771
Author: Alexander Shaposhnikov <sanchaez(a)reactos.org>
AuthorDate: Sun Oct 22 00:52:49 2017 +0300
[RAPPS] Make CConfigParser a temp object.
---
base/applications/rapps/available.cpp | 15 ++++++++++-----
base/applications/rapps/include/available.h | 2 +-
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/base/applications/rapps/available.cpp
b/base/applications/rapps/available.cpp
index 8ee80c93db..f7577f0afc 100644
--- a/base/applications/rapps/available.cpp
+++ b/base/applications/rapps/available.cpp
@@ -19,7 +19,7 @@
// CAvailableApplicationInfo
CAvailableApplicationInfo::CAvailableApplicationInfo(const ATL::CStringW&
sFileNameParam)
- : m_IsInstalled(FALSE), m_HasLanguageInfo(FALSE), m_HasInstalledVersion(FALSE),
m_Parser(sFileNameParam)
+ : m_IsInstalled(FALSE), m_HasLanguageInfo(FALSE), m_HasInstalledVersion(FALSE)
{
m_LicenseType = LICENSE_NONE;
@@ -39,11 +39,14 @@ VOID CAvailableApplicationInfo::RefreshAppInfo()
// Lazily load general info from the file
VOID CAvailableApplicationInfo::RetrieveGeneralInfo()
{
- m_Category = m_Parser.GetInt(L"Category");
+ m_Parser = new CConfigParser(m_sFileName);
+
+ m_Category = m_Parser->GetInt(L"Category");
if (!GetString(L"Name", m_szName)
|| !GetString(L"URLDownload", m_szUrlDownload))
{
+ delete m_Parser;
return;
}
@@ -64,6 +67,8 @@ VOID CAvailableApplicationInfo::RetrieveGeneralInfo()
{
RetrieveInstalledVersion();
}
+
+ delete m_Parser;
}
VOID CAvailableApplicationInfo::RetrieveInstalledStatus()
@@ -87,7 +92,7 @@ VOID CAvailableApplicationInfo::RetrieveLanguages()
ATL::CStringW szBuffer;
// TODO: Get multiline parameter
- if (!m_Parser.GetString(L"Languages", szBuffer))
+ if (!m_Parser->GetString(L"Languages", szBuffer))
{
m_HasLanguageInfo = FALSE;
return;
@@ -126,7 +131,7 @@ VOID CAvailableApplicationInfo::RetrieveLanguages()
VOID CAvailableApplicationInfo::RetrieveLicenseType()
{
- INT IntBuffer = m_Parser.GetInt(L"LicenseType");
+ INT IntBuffer = m_Parser->GetInt(L"LicenseType");
if (IsLicenseType(IntBuffer))
{
@@ -195,7 +200,7 @@ VOID CAvailableApplicationInfo::SetLastWriteTime(FILETIME* ftTime)
inline BOOL CAvailableApplicationInfo::GetString(LPCWSTR lpKeyName, ATL::CStringW&
ReturnedString)
{
- if (!m_Parser.GetString(lpKeyName, ReturnedString))
+ if (!m_Parser->GetString(lpKeyName, ReturnedString))
{
ReturnedString.Empty();
return FALSE;
diff --git a/base/applications/rapps/include/available.h
b/base/applications/rapps/include/available.h
index e005250e81..ab95afc3b3 100644
--- a/base/applications/rapps/include/available.h
+++ b/base/applications/rapps/include/available.h
@@ -64,7 +64,7 @@ private:
BOOL m_IsInstalled;
BOOL m_HasLanguageInfo;
BOOL m_HasInstalledVersion;
- CConfigParser m_Parser;
+ CConfigParser* m_Parser;
inline BOOL GetString(LPCWSTR lpKeyName, ATL::CStringW& ReturnedString);