未验证 提交 72542fa6 编写于 作者: J Jan S 提交者: GitHub

fix(gui): processing threads spinner initialization (#1331)(PR #1332)

* fix: processing threads spinner initialization (#1331)
* fix: processing threads spinner initialization (#1331)
上级 a250d046
......@@ -138,7 +138,7 @@ public class JadxArgs {
}
public void setThreadsCount(int threadsCount) {
this.threadsCount = threadsCount;
this.threadsCount = Math.max(1, threadsCount); // make sure threadsCount >= 1
}
public boolean isCfgOutput() {
......
......@@ -433,8 +433,10 @@ public class JadxSettingsWindow extends JDialog {
needReload();
});
SpinnerNumberModel spinnerModel = new SpinnerNumberModel(
settings.getThreadsCount(), 1, Runtime.getRuntime().availableProcessors() * 2, 1);
// fix for #1331
int threadsCountValue = settings.getThreadsCount();
int threadsCountMax = Math.max(2, Math.max(threadsCountValue, Runtime.getRuntime().availableProcessors() * 2));
SpinnerNumberModel spinnerModel = new SpinnerNumberModel(threadsCountValue, 1, threadsCountMax, 1);
JSpinner threadsCount = new JSpinner(spinnerModel);
threadsCount.addChangeListener(e -> {
settings.setThreadsCount((Integer) threadsCount.getValue());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册