Fix crash in vala outline when entering some invalid code #1356
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1355
The root of the issue is in the libvala library - the parser never finishes on some invalid code lines and there is no obvious way of cancelling it.
To fix the crashes this PR ensures that if one parsing thread stalls and never finishes, a new one is not started.
A limitation of this is that if the code is edited to fix the problematic line, the outline is not re-parsed until the outline pane is hidden and then shown again (or the document closed and reopened - this PR ensures the outline is destroyed on closing the document).
It is questionable whether this issue is likely to occur often enough warrant implementing a more complex fix.
Any advice on how to force the thread to end when the parser has stalled would be welcome.