Merge pull request #395 from yushijinhun/fix

Fix ExportWizardProvider leaks proxy config
This commit is contained in:
huanghongxun
2018-07-18 20:42:42 +08:00
committed by GitHub

View File

@@ -37,6 +37,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.jackhuang.hmcl.setting.ConfigHolder.CONFIG;
public final class ExportWizardProvider implements WizardProvider { public final class ExportWizardProvider implements WizardProvider {
private final Profile profile; private final Profile profile;
private final String version; private final String version;
@@ -80,20 +82,13 @@ public final class ExportWizardProvider implements WizardProvider {
boolean flag = true; boolean flag = true;
try (ZipEngine zip = new ZipEngine(modpackFile)) { try (ZipEngine zip = new ZipEngine(modpackFile)) {
Config config = ConfigHolder.CONFIG.clone(); Config exported = new Config();
exported.setBackgroundImageType(CONFIG.getBackgroundImageType());
config.setHasProxy(false); exported.setBackgroundImage(CONFIG.getBackgroundImage());
config.setSelectedProfile(""); exported.setTheme(CONFIG.getTheme());
config.setCommonDirectory(null); exported.setDownloadType(CONFIG.getDownloadType());
config.setFontFamily("Consolas"); exported.getAuthlibInjectorServers().setAll(CONFIG.getAuthlibInjectorServers());
config.setFontSize(12); zip.putTextFile(exported.toJson(), ConfigHolder.CONFIG_FILENAME);
config.setLocalization(null);
config.getAccounts().clear();
config.setSelectedAccount("");
config.setLogLines(100);
config.getConfigurations().clear();
zip.putTextFile(config.toJson(), ConfigHolder.CONFIG_FILENAME);
zip.putFile(tempModpack, "modpack.zip"); zip.putFile(tempModpack, "modpack.zip");
File bg = new File("bg").getAbsoluteFile(); File bg = new File("bg").getAbsoluteFile();