Changeset 12155


Ignore:
Timestamp:
May 29, 2009, 12:30:48 PM (10 years ago)
Author:
mikel
Message:

make NSCFFooBars stop leaking in the swank-start tests

Location:
trunk/source/cocoa-ide
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/start.lisp

    r12150 r12155  
    9595;;; preference
    9696(defun preference-start-swank? ()
    97   (let* ((defaults (handler-case (#/values (#/sharedUserDefaultsController ns:ns-user-defaults-controller))
     97  (with-autorelease-pool
     98   (let* ((defaults (handler-case (#/values (#/sharedUserDefaultsController ns:ns-user-defaults-controller))
    9899                     (serious-condition (c)
    99100                       (progn (log-debug "~%ERROR: Unable to get preferences from the Shared User Defaults Controller")
     
    127128           (log-debug "~%ERROR: Unrecognized value type in user preference 'startSwankServer': ~S"
    128129                      start-swank-pref)
    129            nil)))))
     130           nil))))))
    130131
    131132(defmethod toplevel-function ((a cocoa-application) init-file)
     
    155156
    156157
    157   (Defun build-ide (bundle-path)
     158  (defun build-ide (bundle-path)
    158159    (setq bundle-path (ensure-directory-pathname bundle-path))
    159160
  • trunk/source/cocoa-ide/swank.lisp

    r12150 r12155  
    4848;;; returns the current value of the "Swank Port" user preference
    4949(defun preference-swank-port ()
    50   (let* ((defaults (handler-case (#/values (#/sharedUserDefaultsController ns:ns-user-defaults-controller))
    51                      (serious-condition (c)
    52                        (progn (log-debug "~%ERROR: Unable to get preferences from the Shared User Defaults Controller")
    53                               nil))))
    54          (swank-port-pref (and defaults (#/valueForKey: defaults #@"swankPort"))))
    55     (cond
    56       ;; the user default is not initialized
    57       ((or (null swank-port-pref)
    58            (%null-ptr-p swank-port-pref)) nil)
    59       ;; examine the user default
    60       ((typep swank-port-pref 'ns:ns-string)
    61        (handler-case (let* ((port-str (lisp-string-from-nsstring swank-port-pref))
    62                             (port (parse-integer port-str :junk-allowed nil)))
    63                        (or port *default-gui-swank-port*))
    64          ;; parsing the port number failed
    65          (ccl::parse-integer-not-integer-string (c)
    66            (setf *ccl-swank-active-p* nil)
    67            (NSLog #@"\nError starting swank server; the swank-port user preference is not a valid port number: %@\n"
    68                   swank-port-pref)
    69            nil)))
    70       ;; the user default value is incomprehensible
    71       (t (progn
    72            (NSLog #@"\nERROR: Unrecognized value type in user preference 'swankPort': %@"
    73                   swank-port-pref)
    74            nil)))))
     50  (with-autorelease-pool
     51    (let* ((defaults (handler-case (#/values (#/sharedUserDefaultsController ns:ns-user-defaults-controller))
     52                       (serious-condition (c)
     53                         (progn (log-debug "~%ERROR: Unable to get preferences from the Shared User Defaults Controller")
     54                                nil))))
     55           (swank-port-pref (and defaults (#/valueForKey: defaults #@"swankPort"))))
     56      (cond
     57        ;; the user default is not initialized
     58        ((or (null swank-port-pref)
     59             (%null-ptr-p swank-port-pref)) nil)
     60        ;; examine the user default
     61        ((typep swank-port-pref 'ns:ns-string)
     62         (handler-case (let* ((port-str (lisp-string-from-nsstring swank-port-pref))
     63                              (port (parse-integer port-str :junk-allowed nil)))
     64                         (or port *default-gui-swank-port*))
     65           ;; parsing the port number failed
     66           (ccl::parse-integer-not-integer-string (c)
     67             (setf *ccl-swank-active-p* nil)
     68             (NSLog #@"\nError starting swank server; the swank-port user preference is not a valid port number: %@\n"
     69                    swank-port-pref)
     70             nil)))
     71        ;; the user default value is incomprehensible
     72        (t (progn
     73             (NSLog #@"\nERROR: Unrecognized value type in user preference 'swankPort': %@"
     74                    swank-port-pref)
     75             nil))))))
    7576
    7677;;; try-starting-swank (&key (force nil))
Note: See TracChangeset for help on using the changeset viewer.