[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] bugfix: add per-key scheme functions to GC roots
From: |
Jason Miller |
Subject: |
Re: [PATCH] bugfix: add per-key scheme functions to GC roots |
Date: |
Fri, 22 May 2020 17:35:40 -0700 |
On Fri, 22 May 2020 17:30:06 -0700, Jason Miller <address@hidden> wrote:
> Prior to this change, the scheme functions could be garbage collected.
> This would eventually cause crashes if any of the scheme functions in
> the user's configuration allocate memory.
The below test-case (reduced from something more real-world) will eventually
crash xbindkeys if you exercise it with:
xdotool click --repeat 10000 --delay 1 1
This patch fixes the problem.
---
(use-modules (ice-9 format))
(let ((myscroll-counter 0)
(big-string
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaa")
;; seconds between"up" scroll events. Lower == faster scrolling higher
== slower scrolling
(myscroll-delay "0.1")
(myscroll-file "/tmp/myscroll"))
(let ((foo
(lambda ()
(set! myscroll-counter (1+ myscroll-counter))
(display (format #f "~A ~A~%" big-string myscroll-counter)))))
(xbindkey-function '("b:1")
(lambda ()
(foo)))
(xbindkey-function '(release "b:1")
(begin (gc)
(lambda ()
(foo))))))
---