forked from I2P_Developers/i2p.i2p
- Use new synchronized change-and-save-config methods
to eliminate races with ReadConfigJob
This commit is contained in:
@@ -416,15 +416,17 @@ public class PluginStarter implements Runnable {
|
||||
File[] tfiles = dir.listFiles();
|
||||
if (tfiles != null) {
|
||||
String current = ctx.getProperty(CSSHelper.PROP_THEME_NAME);
|
||||
Map<String, String> changes = new HashMap();
|
||||
List<String> removes = new ArrayList();
|
||||
for (int i = 0; i < tfiles.length; i++) {
|
||||
String name = tfiles[i].getName();
|
||||
if (tfiles[i].isDirectory() && (!Arrays.asList(STANDARD_THEMES).contains(tfiles[i]))) {
|
||||
ctx.router().removeConfigSetting(ConfigUIHelper.PROP_THEME_PFX + name);
|
||||
removes.add(ConfigUIHelper.PROP_THEME_PFX + name);
|
||||
if (name.equals(current))
|
||||
ctx.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
changes.put(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
}
|
||||
}
|
||||
ctx.router().saveConfig();
|
||||
ctx.router().saveConfig(changes, removes);
|
||||
}
|
||||
|
||||
FileUtil.rmdir(pluginDir, false);
|
||||
|
||||
Reference in New Issue
Block a user