RETURN-TYPE in GLIB::CREATE-SIGNAL-EMIT-FUNCTION
Chisheng Huang <[email protected]> Tue, 25 Sep 2007 18:03:32 -0700 (PDT)
| Newsgroups | gmane.lisp.clg.devel |
|---|---|
| Message-ID | <[email protected]> |
I think RETURN-TYPE in the definition of GLIB::CREATE-SIGNAL-EMIT-FUNCTION
should be used in WITH-GVALUE:
*** gcallback.lisp.~1.46.~ Sun Sep 9 22:07:31 2007
--- gcallback.lisp Tue Sep 25 17:52:34 2007
***************
*** 504,510 ****
finally
(if return-type
(return
! (with-gvalue (return-value)
(%signal-emitv params signal-id detail return-value)))
(%signal-emitv params signal-id detail (make-pointer 0))))
(loop
--- 504,510 ----
finally
(if return-type
(return
! (with-gvalue (return-value return-type)
(%signal-emitv params signal-id detail return-value)))
(%signal-emitv params signal-id detail (make-pointer 0))))
(loop
If RETURN-TYPE is not used in WITH-GVALUE, the following code
(defvar *tmp*)
(progn
(setf *tmp* (make-instance 'gtk:window))
(gtk:signal-connect *tmp*
:configure-event
#'(lambda (event)
(print :configure-event)
(finish-output)))
(gtk:widget-show-all *tmp*))
(glib:signal-emit *tmp*
:configure-event
(multiple-value-bind (w h)
(gtk:widget-get-size-allocation *tmp*)
(make-instance 'gdk:configure-event
:window (gtk:widget-window *tmp*)
:send-event T
:x 0
:y 0
:width w
:height h)))
will cause CMUCL to drop into the debugger:
GLib-GObject: g_value_set_boolean: assertion `G_VALUE_HOLDS_BOOLEAN (value)' failed
[Condition of type GLIB:CRITICAL-LOG-LEVEL]
Restarts:
0: [ABORT] Return to SLIME's top level.
1: [ABORT] Return to Top-Level.
Backtrace:
0: (GLIB::LOG-HANDLER 268431449 268431445)
1: ("call_into_lisp+#x8C [#x8053438] /usr/local/cmucl/bin/lisp")
2: ("funcall3+#x27 [#x8053287] /usr/local/cmucl/bin/lisp")
3: ("Foreign function call land")
Using RETURN-TYPE in WITH-GVALUE cured the problem. As I'm still learning
CLG, could Espen or someone else make sure this is the right fix?
Thanks.
Best,
-cph
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/