summaryrefslogtreecommitdiff
path: root/test/hooks/completion-hide-using-register/rc
AgeCommit message (Collapse)Author
2024-09-02Fix <c-r> use-after-free InsertCompletionHide touches used registerJohannes Altmanninger
Before performing the insertion, InsertCompleter::insert calls try_accept() to accept any selected completion candidate. If there is one, we fire InsertCompletionHide. If that one modifies the register used by <c-r>, the inserted StringViews will be dangling. Fix this by running try_insert first, and read from the register later. Note that we call try_accept() twice but that's fine. It would probably make more sense to copy the register before calling insert() but I don't think it matters. Closes #5220