Walter C. Pelissero | 19 Feb 17:05 2008
Picon

current->source == &current_source_link

This simplified function updates an horizontal scale once a second
based on a value received from another program via a socket.  It also
remotely modifies the same value if the user slides the cursor.  The
updater runs in background as a "timeout" function invoked by GTK.

The problem with it is that after some user activity, I haven't been
able to identify with certainty (I just move the cursor about), I
receive an error of failed assertion in gmain.c.  Sometimes, before
that, the update function (the one going "tick") stops being invoked
and then, more user interaction will cause the error.

I haven't been able to reproduce the error without calling the
SOME-REMOTE-VALUE function, which does a bit of socket I/O.  Maybe
it's got something to do with that.

Has anyone else seen this error before?
What am I doing wrong?

I haven't been able to reproduce the error on SBCL yet but, noticing
that the behaviour of the scale is much more jerky, I'd suspect the
main loop might be quite different under SBCL.

By the way.  CMUCL doesn't seem to need all those explicit casts to
double float I had to put in this sample code.  I'm wondering if it
couldn't be made like that also under SBCL.

----------------------------------------------------------------------

(defun test-background ()
  (clg-init)
  (let* ((scale (make-instance 'h-scale :digits 0
			   :adjustment (adjustment-new 0.0d0 0.0d0 100.0d0 1.0d0 10.0d0 0.0d0)))
	 (window (make-instance 'window
				:default-width 320
				:child scale)))
    (let ((id (glib:timeout-add 1000 #'(lambda ()
					 (format t "tick~%")
					 (setf (range-value scale)
					       (+ 0.0d0 (some-remote-value)))
					 t))))
      (signal-connect scale 'destroy #'(lambda () (glib:timeout-remove id))))
    (signal-connect scale 'change-value
		    #'(lambda (scroll-type value)
			(format t "change-value ~A ~A~%" scroll-type value)
			(setf (some-remote-value) value)))
    (widget-show-all window)))

----------------------------------------------------------------------

GLib: file gmain.c: line 2064 (g_main_dispatch): assertion failed: (current->source == &current_source_link)
   [Condition of type GLIB:ERROR-LOG-LEVEL]

Restarts:
 0: [ABORT] Return to Top-Level.

Backtrace:
  0: (GLIB::LOG-HANDLER 301948240 301948236)
  1: ("Foreign function call land")
  2: ("Foreign function call land")
  3: ("Foreign function call land")
  4: ("Foreign function call land")
  5: ("Foreign function call land")
  6: ("Foreign function call land")
  7: ("Foreign function call land")
  8: ("Foreign function call land")
  9: ("Foreign function call land")
 10: ("Foreign function call land")
 11: (GTK:MAIN-ITERATION-DO NIL)
 12: ("DEFUN MAIN-ITERATE-ALL" #<#1=unused-arg> #<#1#>)[:OPTIONAL]
 13: (LISP::SUB-SERVE-EVENT 0 10000)
 14: (SYSTEM:WAIT-UNTIL-FD-USABLE 0 :INPUT NIL)
 15: (LISP::DO-INPUT #<Stream for Standard Input>)
 16: (LISP::INPUT-CHARACTER #<Stream for Standard Input> NIL (LISP::*EOF*))
 17: (LISP::SYNONYM-IN #<Synonym Stream to SYSTEM:*STDIN*≥
                       NIL
                       (LISP::*EOF*))
 18: (LISP::TWO-WAY-IN
      #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
      NIL
      (LISP::*EOF*))
 19: (READ-CHAR
      #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
      NIL
      (LISP::*EOF*)
      NIL)
 20: (LISP::READ-PRESERVING-WHITESPACE-INTERNAL
      #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
      NIL
      (:EOF)
      T)
 21: (LISP::READ-PRESERVING-WHITESPACE-INTERNAL
      #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
      NIL
      (:EOF)
      NIL)
 22: (LISP::READ-PRESERVING-WHITESPACE-INTERNAL 4
                                                #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
                                                NIL
                                                (:EOF)
                                                ...)[:EXTERNAL]
 23: (LISP::READ-INTERNAL
      #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
      NIL
      (:EOF)
      NIL)
 24: (READ
      #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*≥, Output = #<Synonym Stream to SYSTEM:*STDOUT*≥>
      NIL
      (:EOF)
      NIL)
 25: (LISP::%TOP-LEVEL)
 26: ((LABELS LISP::RESTART-LISP SAVE-LISP))

--

-- 
walter pelissero
http://www.pelissero.de

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane