Skip to content

Fix inconsistent state in TextSelectorEngine if nothing selected

Selecting highlight tool, pressing left mouse button while over text, and immediately releasing without dragging a selection caused inconsistent state.

It left TextSelectorEnigne in the state m_creationCompleted == false and m_lockedItem == something. Then in continuous mode all events kept on being propagated to TextSelectorEngine::event, even if the user started unrelated interactions in the meantime. This caused various side effects.

It notably happened when you double clicked a finished highlight annotation, as described in bug 426658.

We can go to m_creationComplete after release even without a selection, because TextSelectorEngine::end and PageViewAnnotator::performRouteMouseOrTabletEvent handle the case just fine, i.e. don't create an annotation but reset the state machine.

Fixes bug 426658 at least partially. I couldn't reproduce the described crash, so no idea if that's also fixed.

@aacid @gaiarin Would you double check my reasoning? Any idea why the && selection guard was originally introduced?

BUG: 446658

Edited by Tobias Deiminger

Merge request reports