From 5f25dff6ec780035ce815348f14720a5871f15d0 Mon Sep 17 00:00:00 2001 From: Kay Zheng Date: Sun, 24 Jul 2016 09:11:18 +0800 Subject: [PATCH] Deallocate resource IDs when freeing up things --- extensions/xrender.lisp | 6 ++++-- fonts.lisp | 3 ++- requests.lisp | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/extensions/xrender.lisp b/extensions/xrender.lisp index bd9623d..9c0f70b 100644 --- a/extensions/xrender.lisp +++ b/extensions/xrender.lisp @@ -525,13 +525,15 @@ by every function, which attempts to generate RENDER requests." (let ((display (picture-display picture))) (with-buffer-request (display (extension-opcode display "RENDER")) (data +X-RenderFreePicture+) - (picture picture)))) + (picture picture)) + (deallocate-resource-id display (picture-id picture) 'picture))) (defun render-free-glyph-set (glyph-set) (let ((display (glyph-set-display glyph-set))) (with-buffer-request (display (extension-opcode display "RENDER")) (data +X-RenderFreeGlyphSet+) - (glyph-set glyph-set)))) + (glyph-set glyph-set)) + (deallocate-resource-id display (glyph-set-id glyph-set) 'glyph-set))) (defun render-query-version (display) (with-buffer-request-and-reply (display (extension-opcode display "RENDER") nil) diff --git a/fonts.lisp b/fonts.lisp index a5bd4da..d00e4b8 100644 --- a/fonts.lisp +++ b/fonts.lisp @@ -252,7 +252,8 @@ (setf (display-font-cache display) (delete font (display-font-cache display))) ;; Close the font (with-buffer-request (display +x-closefont+) - (resource-id id))))) + (resource-id id)) + (deallocate-resource-id display id 'font)))) (defun list-font-names (display pattern &key (max-fonts 65535) (result-type 'list)) (declare (type display display) diff --git a/requests.lisp b/requests.lisp index 745414c..e802919 100644 --- a/requests.lisp +++ b/requests.lisp @@ -117,8 +117,10 @@ (defun destroy-window (window) (declare (type window window)) - (with-buffer-request ((window-display window) +x-destroywindow+) - (window window))) + (let ((display (window-display window))) + (with-buffer-request (display +x-destroywindow+) + (window window)) + (deallocate-resource-id display (window-id window) 'window))) (defun destroy-subwindows (window) (declare (type window window))