chiark / gitweb /
Fixed memory corruption problem in KEYVAL-NAME
[clg] / gtk / gtktree.lisp
index 55b8e43ff8c522ddafb779c95500e70ad12ba94f..1e238b63b16de20a1f65b77f69086e26668be224 100644 (file)
@@ -20,7 +20,7 @@
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: gtktree.lisp,v 1.29 2007/08/20 11:20:21 espen Exp $
+;; $Id: gtktree.lisp,v 1.32 2007/10/22 09:21:50 espen Exp $
 
 
 (in-package "GTK")
@@ -255,11 +255,12 @@ (defun %make-tree-path (path)
     location))
 
 (defun %tree-path-to-vector (location)
-  (let ((indices (%tree-path-get-indices location))
-       (depth (%tree-path-get-depth location)))
-    (if (null-pointer-p indices)
-       #()
-      (map-c-vector 'vector #'identity indices 'int depth))))
+  (unless (null-pointer-p location)
+    (let ((indices (%tree-path-get-indices location))
+         (depth (%tree-path-get-depth location)))
+      (if (null-pointer-p indices)
+         #()
+       (map-c-vector 'vector #'identity indices 'int depth)))))
 
 (defmacro %with-tree-path ((var path) &body body)
   (let* ((pointer-offset (adjust-offset (size-of 'int) 'pointer))
@@ -383,6 +384,12 @@ (defbinding tree-model-get-iter (model path &optional (iter (make-instance 'tree
   (model tree-model)
   (iter tree-iter :in/return)
   (path tree-path))
+
+#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.12.0")
+(defmethod allocate-foreign ((tree-iter tree-iter) &rest initargs)
+  (declare (ignore initargs))
+  (let ((size (foreign-size (class-of tree-iter))))
+    (slice-alloc size)))
  
 (defun ensure-tree-iter (model row)
   (etypecase row