aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-10-27 21:46:59 +0100
committerbptato <nincsnevem662@gmail.com>2024-10-27 21:46:59 +0100
commita3aec669d0efb3ef94fee8b6a5f8283ba2d8b383 (patch)
tree1903210ce92ecbb21d1d7957f1a3abc54f7fc147 /src
parente0e9e27e5921f3054cab271e8a55b6f1ca41856a (diff)
downloadchawan-a3aec669d0efb3ef94fee8b6a5f8283ba2d8b383.tar.gz
container: fix crash on isearch between redirects
Sadly, pushCursorPos may not be paired with a popCursorPos in case the container in question is replaced during the isearch. The easiest way to reproduce this is: * start request to a page that redirects * start isearch * redirection happens, now the old container is gone * type something Then, popCursorPos would try to pop the cursor position from the new container. An alternative (and better) solution would be to add a weak ref to the container as the line edit data. Sadly, we don't have weak refs, and I don't want to hack them in with finalizers. (But maybe I should. Hmm.)
Diffstat (limited to 'src')
-rw-r--r--src/local/container.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/local/container.nim b/src/local/container.nim
index 0124a3ee..70f8964b 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -1095,7 +1095,7 @@ proc pushCursorPos*(container: Container) =
proc popCursorPos*(container: Container; nojump = false) =
if container.select != nil:
container.select.popCursorPos(nojump)
- else:
+ elif container.bpos.len > 0:
container.pos = container.bpos.pop()
if not nojump:
container.updateCursor()