﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1325	qt-light egg: timers may put chicken into an inconsistent state	John Foerch		"I have found that a Qt::Timer may be used to make callbacks into chicken faster than the callbacks themselves can finish.  This puts chicken into an inconsistent state and causes a crash.  Here is a test case - callback rate and count may need to be adjusted for faster machines.

{{{
(import chicken scheme)

(use qt-light)

(qt:init)

(let* ((thread-rate 0.025)
       (timer (qt:timer thread-rate)))
  (define (timer-callback)
    (let loop ((i 0))
      (if (< i 1e6)
          (loop (+ i 1))
          #t)))
  (qt:connect timer ""timeout()"" timer-callback)
  (qt:start timer)
  (qt:run))
}}}

{{{
$ ./minimal.scm 

Warning: excluded identifier doesn't exist in module foreign: foreign-declare

Warning: excluded identifier doesn't exist in module foreign: foreign-declare
csi: runtime.c:2797: C_save_and_reclaim: Assertion `av > C_temporary_stack_bottom || av < C_temporary_stack_limit' failed.
Aborted
}}}

Since Qt must be used for the main event loop in a Qt program, making timers safe to use would be fairly important for the qt-light egg.  Without knowing much about the internals, I think that maybe a semaphore could be used to block a callback if a previous callback has not finished.  When this occurs, it would be nice if the api also exposed a way for a chicken program to know that a callback was dropped, so that it could take an appropriate action."	defect	new	major	someday	extensions	4.11.0				
