[Clg-devel] Something weird about type GTK:TREE-PATH
Brought to you by:
espen
From: Chisheng H. <cp...@ch...> - 2008-12-26 20:09:35
|
Hi Espen, There is something weird about type GTK:TREE-PATH. To see it, please insert the following into (DEFINE-SIMPLE-DIALOG CREATE-LIST ...) in examples/testgtk.lisp right above (MAKE-INSTANCE 'V-BOX ...) : (glib:signal-connect tree :cursor-changed #'(lambda () (let ((path (gtk:tree-view-get-cursor tree))) (print (list path (type-of path) (typep path 'tree-path) (multiple-value-list (tree-model-get-iter store path)))) (finish-output) (print (ensure-tree-iter store path)) (finish-output)))) After you left click a row in the "List" dialog, the first PRINT will print out a line like the following: (#(6) (SIMPLE-ARRAY (SIGNED-BYTE 32) (1)) T (T #<GTK:TREE-ITER at 0x8231920>)) But ENSURE-TREE-ITER in the second PRINT will throw CMUCL into the debugger: #(6) fell through ETYPECASE expression. Wanted one of (GTK:TREE-ROW-REFERENCE GTK:TREE-PATH GTK:TREE-ITER). [Condition of type CONDITIONS::CASE-FAILURE] Restarts: 0: [CONTINUE] Return from callback function 1: [RE-INVOKE] Re-invoke callback function 2: [DISCONNECT] Disconnect and exit signal handler 3: [ABORT] Return to Top-Level. Backtrace: 0: (GTK:ENSURE-TREE-ITER #<GTK:LIST-STORE at 0x81D0480> #(6)) 1: ("DEFINE-SIMPLE-DIALOG CREATE-LIST") 2: ("DEFMETHOD COMPUTE-SIGNAL-FUNCTION (WIDGET T T T T)" #<GTK:TREE-VIEW at 0x813B260>) 3: ("DEFMETHOD SIGNAL-CONNECT (GOBJECT T T)" #<GTK:TREE-VIEW at 0x813B260>) 4: (GLIB:INVOKE-CALLBACK 70 NIL #<GTK:TREE-VIEW at 0x813B260>) 5: (GLIB::INVOKE-SIGNAL-HANDLER 70 #<unused-arg> #<GTK:TREE-VIEW at 0x813B260>) 6: (GLIB::CALLBACK-TRAMPOLINE #<Function GLIB::INVOKE-SIGNAL-HANDLER {58B819E9}> 70 1 #.(SYSTEM:INT-SAP #x08225A38) ...) 7: (GLIB::SIGNAL-HANDLER-MARSHAL 268431493 268431489) 8: ("call_into_lisp+#x8C [#x80548A0] /usr/local/cmucl/bin/lisp") 9: ("funcall3+#x26 [#x80546D2] /usr/local/cmucl/bin/lisp") 10: ("Foreign function call land") The thing weird about it is PATH is confirmed to be of type TREE-PATH in the first PRINT but (SIMPLE-ARRAY (SIGNED-BYTE 32) (1)) is not a subtype of (VECTOR INTEGER), the defintion of TREE-PATH. Because PATH is a vector generated by a call to MAP-C-VECTOR with INT as the element type, the CMUCL-belly-up problem in ENSURE-TREE-ITER will go away if TREE-PATH is defined by: (deftype tree-path () '(vector int)) With this new DEFTYPE for TREE-PATH, I can get my program to work again but I'm not sure this is the right fix for the problem. Would you please look into it? I'm using * CMUCL snapshot 2008-11 (19E) * glib-2.18.3 and gtk+-2.14.5 * The latest clg from CVS * Gentoo Linux (x86) Best wishes, -cph |