Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xbmc] Addon settings fixes #12536

Merged
merged 1 commit into from Jul 29, 2017

Conversation

@Paxxi
Copy link
Member

commented Jul 20, 2017

Fix a parsing issue for new setting format where settingId would be the element name instead of the id
Fix a conversion issue where settings without category was skipped over.

This should solve log spam of creating settings on the fly for valid addons and properly save/load addons after converted to the new setting format.

@peak3d for testing.

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the Code guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my change
  • All new and existing tests passed
Fix a parsing issue for new setting format where settingId would be t…
…he element name instead of the id

Fix a conversion issue where settings without category was skipped over.

@Paxxi Paxxi added this to the L 18.0-alpha1 milestone Jul 20, 2017

@Paxxi Paxxi requested a review from Montellese Jul 20, 2017

settingId += setting->ValueStr();
auto id = setting->ToElement()->Attribute("id");
if (id)
settingId += id;

This comment has been minimized.

Copy link
@garbear

garbear Jul 20, 2017

Member

Maybe this should be

auto id = setting->ToElement()->Attribute("id");
if (id)
{
  if (!settingId.empty())
    settingId += ".";
  settingId += id;
}

to avoid the dangling "."?

This comment has been minimized.

Copy link
@Paxxi

Paxxi Jul 20, 2017

Author Member

don't think it's required, only check id so we don't crash on a nullptr. It should never return null unless xml is completely broken and we don't really handle that anywhere I think.

This comment has been minimized.

Copy link
@garbear

garbear Jul 20, 2017

Member

agreed

// build a vector of settings from the same category
std::vector<std::shared_ptr<const CSetting>> categorySettings;
std::set<std::string> settingIds;

This comment has been minimized.

Copy link
@peak3d

peak3d Jul 20, 2017

Contributor

Better place the definition on top of the methode and call clear()
Avoids many malloc calls

This comment has been minimized.

Copy link
@Paxxi

Paxxi Jul 27, 2017

Author Member

That means moving it outside the method where it's used. Too ugly for an unknown gain, likely not a hot path so I doubt the extra allocations would be noticable

This comment has been minimized.

Copy link
@peak3d

peak3d Jul 27, 2017

Contributor

The sum of those "minor" things make it big.
I'm really not a friend of consuming CPU power for nothing.

Malloc is not noticable? Will be most possible the worst thing on stl types.
Why does STL implementation does not free the resourcen on clear() ? Performance!

This comment has been minimized.

Copy link
@Paxxi

Paxxi Jul 29, 2017

Author Member

Optimize where it's proven that we're slow. Complicating code for optimizations we don't know are required is the reason our code base is fairly messy and weird.

Had the variable/loop been in the same method i would have made the change but that's not the case now.

@peak3d
Copy link
Contributor

left a comment

Looks good exept the one minor thing

@MartijnKaijser

This comment has been minimized.

Copy link
Member

commented Jul 28, 2017

@Paxxi anything left or need updating?

@Paxxi

This comment has been minimized.

Copy link
Member Author

commented Jul 29, 2017

Good to go @martijn. Was waiting on me looking into peaks comment but no changes are warranted there

@MartijnKaijser MartijnKaijser merged commit 8da9320 into xbmc:master Jul 29, 2017

1 check passed

default You're awesome. Have a cookie
Details
@FernetMenta

This comment has been minimized.

Copy link
Member

commented on xbmc/addons/settings/AddonSettings.cpp in bedd65b Aug 3, 2017

do we really need this log spam? check out this log: http://paste.ubuntu.com/25228685/

This comment has been minimized.

Copy link
Member

replied Aug 3, 2017

That line was already there by @Montellese but just moved.

This comment has been minimized.

Copy link
Member

replied Aug 3, 2017

but now it produced this kind of useless log entries:

22:26:11.075 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting definitions
22:26:11.075 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: trying to load setting definitions from old format...
22:26:11.077 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting values
22:26:16.079 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting definitions
22:26:16.079 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: trying to load setting definitions from old format...
22:26:16.080 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting values
22:26:21.082 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting definitions
22:26:21.082 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: trying to load setting definitions from old format...
22:26:21.084 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting values
22:26:26.087 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting definitions
22:26:26.087 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: trying to load setting definitions from old format...
22:26:26.090 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting values
22:26:31.093 T:138716042320   DEBUG: CAddonSettings[service.nextup.notification]: loading setting definitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.