Fix polyline buffer not always being cleared #1822
Merged
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.
First reported here: https://discuss.pencil2d.org/t/problems-with-nightly-build-11-april-2024/8025
On the bitmap layer, applying a polyline path results in ScribbleArea::paintBitmapBuffer being called, which clears the mTiledBuffer. However, this function is never called when using the tool on the vector layer where the the curve is added by the tool. It will also never get cleared if clearToolData is called directly, but it seems that this function isn't currently being called outside the polyline tool. I've refactored it a bit so when clearToolData is called, the buffer is always cleared (and always after deactivating the tool so ScribbleArea::updateFrame works). One slight change is that isActiveChanged will only be triggered if mPoints is not empty, which makes sense because if it is empty, then the tool was not active and the state is not changing.