Lisp HUG Maillist Archive

Deliver on snow leopard

Hi,

I have a problem to delivering an application on Mac OS 10.6.2 :

When using objc:ensure-objc-initialized to initialize the cocoa library,
definitions of the capi-cocoa-library seem to be lost and the creation of
output-panes crashes the application :

The console says :
++++++++
 *** NSInvocation: warning: object 0x400620 of class
'LWCAPIOutputPaneRepresentation' does not implement
doesNotRecognizeSelector: -- abort
+++++++++

But in fact, when debugging I see that the objc class
LWCAPIOutputPaneRepresentation simply does not exist anymore.

If I don¹t call Œobjc:ensure-objc-initialized, the creation of output panes
works normally, but I cannot use the objc package : all the objc methods are
undefined.

This problem can be tested with the test-cocoa-application-full of the file
"examples/capi/applications/cocoa-application.lisp" of the library. This
example doesn't use the objc package, so it works normally. But if you add a
call to objc:ensure-objc-initialized at the beginning of the launch
function, like this :

(defun test-cocoa-application-full ()
  (objc:ensure-objc-initialized :modules
'("/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation"
"/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa"))
  (capi:set-application-interface
   (make-instance 'cocoa-application-interface-full-test))
  ;; Start the application with no windows initially.
  (capi:convert-to-screen nil))

After delivering, the application crashes when you try to create the first
window with the menu "circle" (because it creates an output pane at this
moment). 

My question is : is it the same on Leopard ? I have 10.4 and 10.6 and I
cannot test 10.5...

Thanks in advance !

Denis


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Deliver on snow leopard

Unable to parse email body. Email id is 9555

Re: Deliver on snow leopard

Re: Deliver on snow leopard Hi Sven,

thanks for the test !
Finally, I found a temporary fix. I replace objc:ensure-objc-initialized with fli:register-module :

(defun initialize-objc ()
  (let ((cocoa "/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa")
        (foundation "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation"))
    (unless (fli:connected-module-pathname cocoa) (fli:register-module cocoa :connection-style :immediate))
    (unless (fli:connected-module-pathname foundation) (fli:register-module foundation :connection-style :immediate))))

And now it works on SL  and on Tiger (so I suppose on Leopard too).
I hope that LW will get us some information about this problem (bug ?).

cordialement

Denis



Le 21/11/09 9:36, « [NOM] » <[ADRESSE]> a écrit :

Hi Denis,

I have tried it on 10.5.8 and I get the following:
---
 *** NSInvocation: warning: object 0x10cd60 of class 'LWCAPIOutputPaneRepresentation' does not implement methodSignatureForSelector: -- trouble ahead
 *** NSInvocation: warning: object 0x10cd60 of class 'LWCAPIOutputPaneRepresentation' does not implement doesNotRecognizeSelector: -- abort
---
/Sven



20 nov 2009 kl. 22.52 skrev Denis Pousseur:



 

Hi,



 

I have a problem to delivering an application on Mac OS 10.6.2 :



 

When using objc:ensure-objc-initialized to initialize the cocoa library,


definitions of the capi-cocoa-library seem to be lost and the creation of


output-panes crashes the application :



 

The console says :


++++++++


*** NSInvocation: warning: object 0x400620 of class


'LWCAPIOutputPaneRepresentation' does not implement


doesNotRecognizeSelector: -- abort


+++++++++



 

But in fact, when debugging I see that the objc class


LWCAPIOutputPaneRepresentation simply does not exist anymore.



 

If I don’t call ‘objc:ensure-objc-initialized, the creation of output panes


works normally, but I cannot use the objc package : all the objc methods are


undefined.



 

This problem can be tested with the test-cocoa-application-full of the file


"examples/capi/applications/cocoa-application.lisp" of the library. This


example doesn't use the objc package, so it works normally. But if you add a


call to objc:ensure-objc-initialized at the beginning of the launch


function, like this :



 

(defun test-cocoa-application-full ()


 (objc:ensure-objc-initialized :modules


'("/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation"


"/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa"))


 (capi:set-application-interface


  (make-instance 'cocoa-application-interface-full-test))


 ;; Start the application with no windows initially.


 (capi:convert-to-screen nil))



 

After delivering, the application crashes when you try to create the first


window with the menu "circle" (because it creates an output pane at this


moment).



 

My question is : is it the same on Leopard ? I have 10.4 and 10.6 and I


cannot test 10.5...



 

Thanks in advance !



 

Denis



 


 

-------------------------------------------------------


Denis Pousseur


70 rue de Wansijn


1180 Bruxelles, Belgique



 

Tel : 32 (0)2 219 31 09


Mail :  denis.pousseur@gmail.com


-------------------------------------------------------



 


 




-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------

Re: Deliver on snow leopard

Unable to parse email body. Email id is 9568

Re: Deliver on snow leopard

Re: Deliver on snow leopard Hi Martin,

I generally use register-module for my own modules but, especially for the objc libraries, the doc says :

“The function ensure-objc-initialized must be called before any other functions in the objc package to initialize the Objective-C system. [...]
The modules argument can be a list of strings specifying foreign modules to load. Typically, this needs to be the paths to the Cocoa .dylib files to make Objective-C work. See fli:register-module .

LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual”

Anyway there is no problem with the solution I use now. It's just a good thing to now that it seems correct to you too.

Best regards

Denis


Le 24/11/09 22:26, « [NOM] » <[ADRESSE]> a écrit :

>>>>>> On Sat, 21 Nov 2009 11:38:47 +0100, Denis Pousseur said:
>>
>> Finally, I found a temporary fix. I replace objc:ensure-objc-initialized
>> with fli:register-module :
>>
>> (defun initialize-objc ()
>>   (let ((cocoa=20
>> "/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa")
>>         (foundation
>> "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation"))
>>     (unless (fli:connected-module-pathname cocoa) (fli:register-module cocoa
>> :connection-style :immediate))
>>     (unless (fli:connected-module-pathname foundation) (fli:register-module
>> foundation :connection-style :immediate))))
>>
>> And now it works on SL  and on Tiger (so I suppose on Leopard too).
>> I hope that LW will get us some information about this problem (bug ?).
>
> The CAPI Cocoa library will only work if it initializes Objective-C itself, so
> I think that using fli:register-module for your own modules is the correct
> solution.  Is there a problem with doing it that way?

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------
Updated at: 2020-12-10 08:40 UTC