* fix: processing threads spinner initialization (#1331) * fix: processing threads spinner initialization (#1331)
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user