Fix stack leaks in X11 backend

slava 2006-03-22 22:22:05 +00:00
parent b0334b14a2
commit ce5a7fb58f
6 changed files with 12 additions and 8 deletions

View File

@ -26,8 +26,8 @@ USING: alien generic hashtables kernel lists math sequences ;
#! gesture, otherwise returns f. #! gesture, otherwise returns f.
[ dupd handle-gesture* ] each-parent nip ; [ dupd handle-gesture* ] each-parent nip ;
: user-input ( str gadget -- ? ) : user-input ( str gadget -- )
[ dupd user-input* ] each-parent nip ; [ dupd user-input* ] each-parent 2drop ;
! Mouse gestures are lists where the first element is one of: ! Mouse gestures are lists where the first element is one of:
SYMBOL: motion SYMBOL: motion

View File

@ -128,8 +128,8 @@ V{ } clone hand-buttons set-global
: ui-step ( -- ) : ui-step ( -- )
do-timers do-timers
[ layout-queued ] make-hash [ layout-queued ] make-hash hash-values
[ nip dup world-handle [ draw-world ] when ] hash-each [ dup world-handle [ draw-world ] [ drop ] if ] each
10 sleep ; 10 sleep ;
: close-world ( world -- ) : close-world ( world -- )

View File

@ -13,6 +13,8 @@ sequences ;
{ "Documentation" [ [ handbook ] in-browser ] } { "Documentation" [ [ handbook ] in-browser ] }
{ "Tutorial" [ [ tutorial ] in-browser ] } { "Tutorial" [ [ tutorial ] in-browser ] }
{ "Vocabularies" [ [ vocabs. ] in-browser ] } { "Vocabularies" [ [ vocabs. ] in-browser ] }
{ "Globals" [ [ global describe ] in-browser ] }
{ "Memory" [ [ heap-stats. terpri room. ] in-browser ] }
{ "Save image" [ save ] } { "Save image" [ save ] }
{ "Exit" [ 0 exit ] } { "Exit" [ 0 exit ] }
} <launchpad> ; } <launchpad> ;

View File

@ -50,4 +50,4 @@ M: world find-world ;
world-focus parents reverse-slice ; world-focus parents reverse-slice ;
: simple-window ( gadget title -- ) : simple-window ( gadget title -- )
>r f over pref-dim r> in-window ; >r f over pref-dim { 800 800 0 } vmin r> in-window ;

View File

@ -72,9 +72,9 @@ M: world motion-event ( event world -- )
M: world key-down-event ( event world -- ) M: world key-down-event ( event world -- )
world-focus over event>gesture [ world-focus over event>gesture [
over handle-gesture over handle-gesture
[ over lookup-string nip swap user-input ] [ 2drop ] if [ swap lookup-string nip swap user-input ] [ 2drop ] if
] [ ] [
drop 2drop
] if* ; ] if* ;
M: world key-up-event ( event world -- ) 2drop ; M: world key-up-event ( event world -- ) 2drop ;

View File

@ -26,9 +26,11 @@ SYMBOL: root
dpy get XDefaultScreen scr set dpy get XDefaultScreen scr set
dpy get scr get XRootWindow root set ; dpy get scr get XRootWindow root set ;
: close-x ( -- ) dpy get XCloseDisplay drop ;
: with-x ( display-string quot -- ) : with-x ( display-string quot -- )
[ [
H{ } clone windows set H{ } clone windows set
swap initialize-x swap initialize-x
call [ close-x ] cleanup
] with-scope ; ] with-scope ;