Propagate destroy through <gtk-container>. Use it with <fix-layout>s.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Fri, 16 Sep 2011 19:18:07 +0000 (12:18 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Fri, 16 Sep 2011 19:18:07 +0000 (12:18 -0700)
src/gtk/fix-layout.scm
src/gtk/gtk-object.scm
src/gtk/gtk.pkg

index fe51b033bfcbc58887602f9554a8d5347cb985b5..31c7f46a4e568ada2f8ce000ad074942a3cfd57f 100644 (file)
@@ -65,6 +65,11 @@ USA.
 
 (define-guarantee fix-layout "a <fix-layout>")
 
+(define-method gtk-object-destroy-callback ((layout <fix-layout>))
+  (call-next-method layout)
+  (let ((drawing (fix-layout-drawing layout)))
+    (if drawing (fix-drawing-remove-widget! drawing layout))))
+
 (define-integrable (allocate-color! layout spec)
   (let* ((colors (fix-layout-colors layout))
         (entry (assoc spec colors)))
index e9ae02d382e4b5f0de7e82046d6fb1de6f720400..f8969b56973244c11b34134c98b995cf666bf914 100644 (file)
@@ -452,6 +452,10 @@ USA.
   ;; they were added.
   (reverse-children define standard initial-value '()))
 
+(define-method gtk-object-destroy-callback ((container <gtk-container>))
+  (call-next-method container)
+  (for-each gtk-object-destroy (gtk-container-reverse-children container)))
+
 (define-guarantee gtk-container "a <gtk-container>")
 
 (define (gtk-container-children container)
index 94d470498c5119fd5c89b3c6abbaa39b0db4cee6..c1041f6cd4599929e906d90a3e9d506fc920dda0 100644 (file)
@@ -213,7 +213,9 @@ USA.
   (import (gtk pango)
           make-pango-layout pango-rectangle pangos->pixels pixels->pangos)
   (import (gtk gtk-object)
-         parse-gdkcolor set-gtk-object-destroy-callback!)
+         parse-gdkcolor
+         set-gtk-object-destroy-callback!
+         gtk-object-destroy-callback)
   (export (gtk)
 
          <fix-layout> fix-layout? make-fix-layout set-fix-layout-size!