Skip to content

Commit

Permalink
[addons] Reset addon settings when destroying the addon instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksooo committed Dec 21, 2020
1 parent d02291e commit 347f757
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xbmc/addons/Addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ bool CAddon::ReloadSettings()
return LoadSettings(true);
}

void CAddon::ResetSettings()
{
m_settings.reset();
}

bool CAddon::LoadUserSettings()
{
if (!SettingsInitialized())
Expand Down
2 changes: 2 additions & 0 deletions xbmc/addons/Addon.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ class CAddon : public IAddon
}
bool ReloadSettings() override;

void ResetSettings() override;

/*! \brief retrieve the running instance of an add-on if it persists while running.
*/
AddonPtr GetRunningInstance() const override { return AddonPtr(); }
Expand Down
1 change: 1 addition & 0 deletions xbmc/addons/IAddon.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ namespace ADDON
virtual bool MeetsVersion(const AddonVersion& versionMin,
const AddonVersion& version) const = 0;
virtual bool ReloadSettings() =0;
virtual void ResetSettings() = 0;
virtual AddonPtr GetRunningInstance() const=0;
virtual void OnPreInstall() =0;
virtual void OnPostInstall(bool update, bool modal) =0;
Expand Down
3 changes: 3 additions & 0 deletions xbmc/addons/binary-addons/AddonDll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ void CAddonDll::Destroy()
m_pDll = nullptr;
CLog::Log(LOGINFO, "ADDON: Dll Destroyed - %s", Name().c_str());
}

ResetSettings();

m_initialized = false;
}

Expand Down

0 comments on commit 347f757

Please sign in to comment.