-
Notifications
You must be signed in to change notification settings - Fork 93
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
DataPointTooltip missing dataset synchronization #337
Comments
It seems there is already the |
Yes readLockGuard would probably be the preferred way to make this safe. One problem I see is the way the code is written now it would need to block all DataSets for the whole search. This should probably be changed to extract the relevant information from each DataSet inside of a read lock guard and then decide afterwards which one is the closest and should be shown. Otherwise the next problem will occur when it tries to get the label for a point which was deleted in the meantime. Thanks for reporting and the detailed description 👍 re dataset.isSorted(), we discussed this a lot already, but there along with the benefits there are some complications that prevented us from implementing this. Main points being: all code has to offer paths for both sorted and unsorted, how to ensure sortedness on dataset manipulation, what happens with multidimensional datasets, more to implement for people using their own datasets. |
fixed by #339 |
I think there might be race condition in the
DataPointTooltip
code regarding the lookup of points near the mouse and getting the data set's values.First the index of valid points is fetched, then later it's value is fetched. In the meantime the dataset could have been cleared resulting in an out of bounds exception.
https://github.com/GSI-CS-CO/chart-fx/blob/fc81f1fa2fced4d4102bbc4fa3558cef35742a7e/chartfx-chart/src/main/java/de/gsi/chart/plugins/DataPointTooltip.java#L126
And then:
https://github.com/GSI-CS-CO/chart-fx/blob/fc81f1fa2fced4d4102bbc4fa3558cef35742a7e/chartfx-chart/src/main/java/de/gsi/chart/plugins/DataPointTooltip.java#L134
I observed the following stacktrace regarding this:
Happened 2020-11-30 13:37:04 +01:00.
Do you have a suggestion on how to fix this? I think a mechanism to search the dataset using a lambda could be a nice and versatile solution. Additionally the DS could decide for itself if it is sorted or not.
Like (just a sketch):
Or maybe the plugin could simply issue a lock and unlock.
The text was updated successfully, but these errors were encountered: