aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-05-04 11:40:50 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2024-05-04 11:40:50 +0200
commit9cd4194528b2d73d83abd1364fecd9b334793444 (patch)
tree9e48e6d82d4f3359949f71e9be22f9530c8b0a3b
parent1c0074fbaa825fcb03bca6876636e6a7abaca7f4 (diff)
downloadvis-lockfiles-9cd4194528b2d73d83abd1364fecd9b334793444.tar.gz
vis-lockfiles-9cd4194528b2d73d83abd1364fecd9b334793444.zip
stop further WIN_OPEN event handling if we aborted
Closing the window invalidates the handle passed to further event handlers probably causing them to crash.
-rw-r--r--init.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index f73e13a..723e046 100644
--- a/init.lua
+++ b/init.lua
@@ -72,7 +72,10 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
if lockfiles.vis_pid == lock_pid then
created_locks[file.path] = lfile_path
else
- prompt(file.path, lfile_path, lock_pid)
+ if not prompt(file.path, lfile_path, lock_pid) then
+ -- return ~= nil to stop further event handling since we closed the window
+ return true
+ end
end
end)