[gtk-cffi-cvs] CVS gtk-cffi/ext

CVS User rklochkov rklochkov at common-lisp.net
Sat Jul 21 19:26:39 UTC 2012


Update of /project/gtk-cffi/cvsroot/gtk-cffi/ext
In directory tiger.common-lisp.net:/tmp/cvs-serv799/ext

Modified Files:
	lisp-model.lisp 
Log Message:
Changed GtkTreePath representation in lisp. 
It was a pointer, now it is an array to prevent memory leak.


--- /project/gtk-cffi/cvsroot/gtk-cffi/ext/lisp-model.lisp	2012/05/08 09:38:07	1.4
+++ /project/gtk-cffi/cvsroot/gtk-cffi/ext/lisp-model.lisp	2012/07/21 19:26:38	1.5
@@ -88,13 +88,12 @@
     (warn "Undefined implementation of GET-ITER for ~a" lisp-model-impl)))
 
 (defun set-iter (iter index)
-;  (break)
   (setf (stamp iter) 0
         (u1 iter) (make-pointer index))
   t)
 
 (defmethod get-iter ((lisp-model-list lisp-model-list) iter path)
-  (let ((index (get-index (make-instance 'tree-path :pointer path))))
+  (let ((index (aref path 0)))
     (when (< index (lisp-model-length lisp-model-list))
       (set-iter iter index))))
 
@@ -106,9 +105,9 @@
           (values t (car child) (cdr child))))))
 
 (defmethod get-iter ((lisp-model lisp-model-tree-array) iter path)
-  (let ((address (get-indices (make-instance 'tree-path :pointer path))))
-    (multiple-value-bind (found index) (descend (tree lisp-model) address)
-      (when found (set-iter iter index)))))
+  (multiple-value-bind (found index) (descend (tree lisp-model) 
+                                              (coerce path 'list))
+    (when found (set-iter iter index))))
 
 (defun iter->index (iter)
   (pointer-address (u1 iter)))
@@ -118,11 +117,9 @@
   
 (defgeneric get-path (lisp-model-impl iter)
   (:method ((lisp-model-list lisp-model-list) iter)
-    (make-instance 'tree-path :indices (list (iter->index iter)) 
-                   :free-after nil))
+    (list (iter->index iter)))
   (:method ((lisp-model lisp-model-tree-array) iter)
-    (make-instance 'tree-path :string (car (iter->aref lisp-model iter))
-                   :free-after nil)))
+    (car (iter->aref lisp-model iter))))
 
 (defun set-value (g-value value-list n)
   (g-object-cffi::init-g-value g-value nil (nth n value-list) t))
@@ -177,6 +174,7 @@
 
 (defgeneric iter-children (lisp-model-impl iter parent)
   (:method ((lisp-model-list lisp-model-list) iter parent)
+;    (break)
     (unless parent
       (set-iter iter 0)))
   (:method ((lisp-model lisp-model-tree-array) iter parent)
@@ -255,6 +253,7 @@
         :collecting
          `(defcallback ,(symbolicate '#:cb- callback) ,(car args) 
               ((object pobject) ,@(cdr args))
+            ;(debug-out "callback: ~a~%" ',callback)
             (,callback (implementation object) ,@(mapcar #'car (cdr args)))))
      (defcallback ,(symbolicate  '#:cb-init- interface) 
          :void ((class ,interface))
@@ -267,19 +266,23 @@
  get-flags (:int)
  get-n-columns (:int)
  get-column-type (:int (index :int))
- get-iter (:boolean (iter (struct tree-iter)) (path :pointer))
- get-path (pobject (iter (struct tree-iter)))
- get-value (:void (iter (struct tree-iter)) (n :int) (value :pointer))
- iter-next (:boolean (iter (struct tree-iter)))
- iter-previous (:boolean (iter (struct tree-iter)))
- iter-children (:boolean (iter (struct tree-iter)) (parent (struct tree-iter))) 
- iter-has-child (:boolean (iter (struct tree-iter)))
- iter-n-children (:int (iter (struct tree-iter)))
- iter-nth-child (:boolean (iter (struct tree-iter)) 
-                          (parent (struct tree-iter)) (n :int))
- iter-parent (:boolean (iter (struct tree-iter)) (child (struct tree-iter)))
- ref-node (:void (iter (struct tree-iter)))
- unref-node (:void (iter (struct tree-iter))))
+ get-iter (:boolean (iter (object tree-iter))
+                    (path (tree-path :free nil)))
+ get-path ((tree-path :free nil) (iter (object tree-iter)))
+ get-value (:void (iter (object tree-iter)) (n :int)
+                  (value :pointer))
+ iter-next (:boolean (iter (object tree-iter)))
+ iter-previous (:boolean (iter (object tree-iter)))
+ iter-children (:boolean (iter (object tree-iter)) 
+                         (parent (object tree-iter))) 
+ iter-has-child (:boolean (iter (object tree-iter)))
+ iter-n-children (:int (iter (object tree-iter)))
+ iter-nth-child (:boolean (iter (object tree-iter)) 
+                          (parent (object tree-iter)) (n :int))
+ iter-parent (:boolean (iter (object tree-iter)) 
+                       (child (object tree-iter)))
+ ref-node (:void (iter (object tree-iter)))
+ unref-node (:void (iter (object tree-iter))))
 
 
 (defcstruct g-interface-info





More information about the gtk-cffi-cvs mailing list