New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CheckComboBox: IndexOutOfBoundsException on clearChecks() #1531
Comments
Is this repo still active? |
I would say yes ;-) I am not the driver behind ControlsFX but I think you (and maybe many others) need to understand that most of the people contributing to an open source project do it in their spare time. If you feel an issue needs to be fixed I think it is a good time to start looking into more closely and help to improve the code 👍. |
Hello, I found a more straightforward method to reproduce the bug, which suggests some clues about what might be happening in the code execution: import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.controlsfx.control.CheckComboBox;
public class Test extends Application {
@Override
public void start(Stage stage) throws Exception {
CheckComboBox<String> cb = new CheckComboBox<>();
cb.getItems().setAll("James", "Emma", "William");
StackPane root = new StackPane(cb);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
// Check actions after the stage show. Check on index '2' is vital to reproduce the bug.
cb.getCheckModel().check(2);
cb.getCheckModel().check(1);
cb.getCheckModel().clearChecks();
cb.getCheckModel().check(2);
// It could also be reproduced by checking index '1' instead, as shown below:
/*
cb.getCheckModel().check(1);
cb.getCheckModel().check(0);
cb.getCheckModel().clearChecks();
cb.getCheckModel().check(1);
*/
}
public static void main(String[] args) {
launch();
}
} It is important to note that the checkbox actions are performed after the stage.show() function is called. Here is the stack trace for reference:
|
This is fixed in 11.2.1. Thanks @abhinayagarwal . |
I just tested the example shown in the original issue using v11.2.1 and still throws the same @credmond , @abhinayagarwal, what was solved in v11.2.1? |
@dsubelman Sorry, no, it wasn't solved actually. You're right, the first example is still failing (I was testing the second example -- assumed it was all the same thing). @abhinayagarwal: can you re-open? I've not used this control in the past until now, so I can't speak about previous behaviour -- but even since this fix, there are still odd random display bugs, whereby the checkbox of one of the items can stay unchecked permanently (unless you specifically click the checkbox itself). The "title" of the combox doesn't reflect what's visually selected. It doesn't behave correctly thereafter once this happens, needs to be re-created. Seems to be some listeners gets out of sync, or perhaps something is getting GC'd when it shouldn't. Just reproduced it now, first time: I can click the label/row of 0 and it'll update the title accordingly, but the checkbox won't change; it'll reamain unselected. This doesn't appear to occur in reverse (checkbox always "checked"). I have typed a lot here now, and realise this should probably be a bug on its own. But really my question is, do we feel these bugs were introduced in 11.2.0? |
A bug was introduced in v11.2.0 where an
IndexOutOfBoundsException
is thrown when callingcomboBox.getCheckModel().clearChecks()
after an item is removed.Here's an example that reproduces the issue:
Stack trace:
The text was updated successfully, but these errors were encountered: