From d4c0aa1dafb8ccc812b7fc4649146aa51f5448e7 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 15 Apr 2010 23:07:27 -0400 Subject: [PATCH] added guard against passing #f to the make-button procedure --- .../drscheme/private/module-language-tools.ss | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/collects/drscheme/private/module-language-tools.ss b/collects/drscheme/private/module-language-tools.ss index 2ea943582d..8baaff58b2 100644 --- a/collects/drscheme/private/module-language-tools.ss +++ b/collects/drscheme/private/module-language-tools.ss @@ -134,40 +134,41 @@ (info-result 'drscheme:opt-out-toolbar-buttons '()))))))) (inherit get-tab) + (define/private (register-new-buttons buttons opt-out-ids) - (let* ([tab (get-tab)] [frame (send tab get-frame)]) - (send frame begin-container-sequence) - (let ([directly-specified-buttons - (map (λ (button-spec) - (new switchable-button% - [label (list-ref button-spec 0)] - [bitmap (list-ref button-spec 1)] - [parent (send frame get-toolbar-button-panel)] - [callback - (lambda (button) - ((list-ref button-spec 2) frame))])) - (or buttons '()))] - [opt-out-buttons - (if (eq? opt-out-ids #f) - '() - (map - (λ (opt-out-toolbar-button) - ((opt-out-toolbar-button-make-button opt-out-toolbar-button) - frame - (send frame get-toolbar-button-panel))) - (filter (λ (opt-out-toolbar-button) - (not (member (opt-out-toolbar-button-id opt-out-toolbar-button) - opt-out-ids))) - opt-out-toolbar-buttons)))]) - (send tab set-lang-toolbar-buttons - (sort - (append directly-specified-buttons - opt-out-buttons) - string<=? - #:key (λ (x) (send x get-label))))) - (send frame end-container-sequence))) + (when (send frame initialized?) + (send frame begin-container-sequence) + (let ([directly-specified-buttons + (map (λ (button-spec) + (new switchable-button% + [label (list-ref button-spec 0)] + [bitmap (list-ref button-spec 1)] + [parent (send frame get-toolbar-button-panel)] + [callback + (lambda (button) + ((list-ref button-spec 2) frame))])) + (or buttons '()))] + [opt-out-buttons + (if (eq? opt-out-ids #f) + '() + (map + (λ (opt-out-toolbar-button) + ((opt-out-toolbar-button-make-button opt-out-toolbar-button) + frame + (send frame get-toolbar-button-panel))) + (filter (λ (opt-out-toolbar-button) + (not (member (opt-out-toolbar-button-id opt-out-toolbar-button) + opt-out-ids))) + opt-out-toolbar-buttons)))]) + (send tab set-lang-toolbar-buttons + (sort + (append directly-specified-buttons + opt-out-buttons) + string<=? + #:key (λ (x) (send x get-label))))) + (send frame end-container-sequence)))) (inherit get-text) (define/private (get-lang-name pos)