Skip to content
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

> #3339 NPE caused by null defaultImage in XtextEditorTickUpdater (updateEditorImage) #3340

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mehmet-karaman
Copy link
Contributor

@mehmet-karaman mehmet-karaman commented Feb 7, 2025

Set fields to volatile which could possible be accessed by multiple threads. Used local variables to store the value and added check with local variable.

@cdietrich
Copy link
Contributor

can you also have a look at the subclasses

@mehmet-karaman
Copy link
Contributor Author

mehmet-karaman commented Feb 7, 2025

There is only one subclass (XtendEditorErrorTickUpdater), which has only one field and that is not set to null..

@mehmet-karaman
Copy link
Contributor Author

Ah .. I've got it.. Classes which implement this interface IXtextEditorCallback :)

Copy link

github-actions bot commented Feb 7, 2025

Test Results

  6 457 files   -  4    6 457 suites   - 4   3h 14m 0s ⏱️ - 3m 0s
 43 241 tests ± 0   42 656 ✅  -  1    584 💤 ±0  0 ❌ ±0  1 🔥 +1 
170 028 runs   - 23  167 693 ✅  - 21  2 334 💤  - 3  0 ❌ ±0  1 🔥 +1 

For more details on these errors, see this check.

Results for commit e9d5e0f. ± Comparison against base commit 2e919f4.

♻️ This comment has been updated with latest results.

@mehmet-karaman mehmet-karaman force-pushed the 3339_NPE_caused_by_null_defaultImage_in_XtextEditorTickUpdater branch from 3df46c9 to e9d5e0f Compare February 7, 2025 12:28
@mehmet-karaman
Copy link
Contributor Author

Found one more case, where this could happen.. OverrideIndicatorModelListener uses the editor, which is unset and its not volatile.. I've also used it as local variable to avoid setting to null afterwards..

@cdietrich
Copy link
Contributor

no i mean the xtend one. do we need the local stuff you do there too

@mehmet-karaman
Copy link
Contributor Author

Oh now I looked again, the changes in the "OverrideIndicatorModelListener" are not necessary, because the field is accessed only in the UI thread.. So no worker thread should execute this code..

The problem happens only if the UI thread calls the beforeDispose, meanwhile a worker thread accesses the fields which are set by the beforeDispose method to null. If you check the stacktrace in the ticket, you will see that the defaultImage is accessed by the worker thread, where the UI thread already set this defaultImage to null..

@mehmet-karaman
Copy link
Contributor Author

We can keep the changes.. Maybe there is a worker thread which does the same for the next time.. So It shouldn't harm to keep these changes..

@mehmet-karaman mehmet-karaman marked this pull request as ready for review February 7, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants