Skip to content
This repository

fix growing guisettings.xml caused by duplicate entries for resolutions #1486

Merged
merged 1 commit into from almost 2 years ago

2 participants

Rainer Hochecker Memphiz
Rainer Hochecker
Collaborator

When windows profiles are used, settings get loaded more than once which resulted in duplicate entries for resolutions. guisettings.xml grew exponentially.

Memphiz
Owner

Looks good. If users load their 500MB guisettings.xml the first time it will get rid of all dupes if i read it correctly. Nice thing :)

Rainer Hochecker FernetMenta merged commit f5538a9 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 27, 2012
Rainer Hochecker FernetMenta settings: fix growing guisettings.xml caused by duplicate entries for…
… resolutions
a015a77
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 14 additions and 2 deletions. Show diff stats Hide diff stats

  1. +14 2 xbmc/settings/Settings.cpp
16 xbmc/settings/Settings.cpp
@@ -480,6 +480,8 @@ void CSettings::SetViewState(TiXmlNode *pRootNode, const CStdString &strTagName,
480 480
481 481 bool CSettings::LoadCalibration(const TiXmlElement* pRoot, const CStdString& strSettingsFile)
482 482 {
  483 + m_Calibrations.clear();
  484 +
483 485 const TiXmlElement *pElement = pRoot->FirstChildElement("resolutions");
484 486 if (!pElement)
485 487 {
@@ -514,8 +516,18 @@ bool CSettings::LoadCalibration(const TiXmlElement* pRoot, const CStdString& str
514 516 // we must not delete those, resolution just might not be available
515 517 cal.iWidth = cal.iHeight = 0;
516 518
517   - // store calibration
518   - m_Calibrations.push_back(cal);
  519 + // store calibration, avoid adding duplicates
  520 + bool found = false;
  521 + for (std::vector<RESOLUTION_INFO>::iterator it = m_Calibrations.begin(); it != m_Calibrations.end(); ++it)
  522 + {
  523 + if (it->strMode.Equals(cal.strMode))
  524 + {
  525 + found = true;
  526 + break;
  527 + }
  528 + }
  529 + if (!found)
  530 + m_Calibrations.push_back(cal);
519 531
520 532 // iterate around
521 533 pResolution = pResolution->NextSiblingElement("resolution");

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.