mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-06 06:14:43 -04:00
UI: Use unique_ptr for theme objects
This commit is contained in:
@@ -417,6 +417,7 @@ static vector<OBSThemeVariable> ParseThemeVariables(const char *themeData)
|
||||
void OBSApp::FindThemes()
|
||||
{
|
||||
string themeDir;
|
||||
unique_ptr<OBSTheme> theme;
|
||||
|
||||
QStringList filters;
|
||||
filters << "*.obt" // OBS Base Theme
|
||||
@@ -427,11 +428,9 @@ void OBSApp::FindThemes()
|
||||
GetDataFilePath("themes/", themeDir);
|
||||
QDirIterator it(QString::fromStdString(themeDir), filters, QDir::Files);
|
||||
while (it.hasNext()) {
|
||||
OBSTheme *theme = ParseThemeMeta(it.next());
|
||||
theme.reset(ParseThemeMeta(it.next()));
|
||||
if (theme && !themes.contains(theme->id))
|
||||
themes[theme->id] = std::move(*theme);
|
||||
else
|
||||
delete theme;
|
||||
}
|
||||
|
||||
themeDir.resize(1024);
|
||||
@@ -441,11 +440,9 @@ void OBSApp::FindThemes()
|
||||
QDir::Files);
|
||||
|
||||
while (it.hasNext()) {
|
||||
OBSTheme *theme = ParseThemeMeta(it.next());
|
||||
theme.reset(ParseThemeMeta(it.next()));
|
||||
if (theme && !themes.contains(theme->id))
|
||||
themes[theme->id] = std::move(*theme);
|
||||
else
|
||||
delete theme;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user