Re: capi:collect-interfaces error

Martin Simmons <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
We should probably do better at preventing the error you got, but calling
capi:collect-interfaces with :sort-by :visible is not safe from a random
thread on macOS because it needs to make Cocoa calls to find the z order.

The default :sort-by :create should be safe, but of course can return out of
date information.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/



>>>>> On Mon, 16 Mar 2026 18:32:38 +0000, John DeSoi (as john at desoi dot dev) said:
> 
> On macOS when I call capi:collect-interfaces at a point where some interfaces may be closing, I get the error below. I think this is because the interface may have been collected right when it was closing causing the sort operation to error because it no longer has a Cocoa representation. 
> 
> I thought it was safe to call this function from outside of the interface process. If not, I don't see how it should be called using something like capi:apply-in-pane-process-wait-single if I don't have any interface to start with. Seems like a bug where the interface should have been removed before the sort.
> 
> Thanks,
> 
> John DeSoi, Ph.D.
> 
> 
> 
> Call to CERROR {offset 568}
>   CONDITIONS::CONTINUE-STRING  {Closing} : "Call ~S again"
>   CONDITIONS::DATUM                      : "No applicable methods for ~S with args ~S"
>   CONDITIONS::ARGUMENTS  {Closing}       : (#<STANDARD-GENERIC-FUNCTION CAPI-COCOA-LIBRARY::REPRESENTATION-WINDOW 80E0567E79> (NIL))
> 
> Call to (METHOD NO-APPLICABLE-METHOD (T)) {offset 64}
>   CLOS::GF   : #<STANDARD-GENERIC-FUNCTION CAPI-COCOA-LIBRARY::REPRESENTATION-WINDOW 80E0567E79>
>   CLOS::ARGS : (NIL)
> 
> Call to CAPI-COCOA-LIBRARY::COCOA-Z-SORT-CHILDREN-WITH-KEY {offset 264}
>   CAPI-COCOA-LIBRARY::ALL-CHILDREN  : #(#<Pointer: OBJC:OBJC-OBJECT-POINTER = #x0000000103907300> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x0000000143320060> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x00000001240B1390> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x00000001241FBC90> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x0000000124281BB0> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x000000010393B430> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x000000010395E680> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x000000012414ADE0> #<Pointer: OBJC:OBJC-OBJECT-POINTER = #x000000010390E9A0>)
>   CAPI-COCOA-LIBRARY::CAPI-CHILDREN : (#<D5::FORM-INTERFACE "D5" 81B0869903> #<D5::FORM-INTERFACE "Method: 1000 / 8186" 81B086A8C3> #<D5::FORM-INTERFACE "Structure: 5 / 5" 8260009D33> #<D5::FORM-INTERFACE "Method Call: 1000 / 38087" 8260009B53>)
>   CAPI-COCOA-LIBRARY::KEY           : CAPI-COCOA-LIBRARY::REPRESENTATION-WINDOW
> 
> Call to (METHOD CAPI:COLLECT-INTERFACES (CAPI:INTERFACE)) {offset 872}
>   CAPI::PROTO                 : #<D5::FORM-INTERFACE {Prototype} 81B03368BB>
>   DBG::G                      : (:SCREEN :ANY :SORT-BY :VISIBLE)
>   CAPI:SCREEN                 : :ANY
>   CAPI::KEEP-ORDER            : NIL
>   CAPI::CURRENT-PROCESS-FIRST : T
>   CAPI::SORT-BY  {Closing}    : :VISIBLE
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> [email protected]
> http://www.lispworks.com/support/lisp-hug.html
> 

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.