skelterjohn / go.wde

Windows, drawing and events for Go
217 stars 46 forks source link

wdetest crashes on OSX lion #48

Closed tcolar closed 8 years ago

tcolar commented 8 years ago

Is it just too old ? The doc does not specify a minimum version as far as I can tell.

Thank you.

go run wdetest.go 
2016-01-17 10:16:26.452 wdetest[21564:303] -[NSNib initWithNibData:bundle:]: unrecognized selector sent to instance 0x520dc90
2016-01-17 10:16:26.454 wdetest[21564:303] An uncaught exception was raised
2016-01-17 10:16:26.456 wdetest[21564:303] -[NSNib initWithNibData:bundle:]: unrecognized selector sent to instance 0x520dc90
2016-01-17 10:16:26.457 wdetest[21564:303] (
    0   CoreFoundation                      0x00007fff8e758f56 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff8b126d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8e7e51be -[NSObject doesNotRecognizeSelector:] + 190
    3   CoreFoundation                      0x00007fff8e745e23 ___forwarding___ + 371
    4   CoreFoundation                      0x00007fff8e745c38 _CF_forwarding_prep_0 + 232
    5   wdetest                             0x00000000040e6615 initMacDraw + 229
    6   wdetest                             0x00000000040e49de _cgo_cd68b64375d7_Cfunc_initMacDraw + 46
    7   wdetest                             0x000000000405a160 runtime.asmcgocall + 112
)
2016-01-17 10:16:26.458 wdetest[21564:303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNib initWithNibData:bundle:]: unrecognized selector sent to instance 0x520dc90'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8e758f56 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff8b126d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8e7e51be -[NSObject doesNotRecognizeSelector:] + 190
    3   CoreFoundation                      0x00007fff8e745e23 ___forwarding___ + 371
    4   CoreFoundation                      0x00007fff8e745c38 _CF_forwarding_prep_0 + 232
    5   wdetest                             0x00000000040e6615 initMacDraw + 229
    6   wdetest                             0x00000000040e49de _cgo_cd68b64375d7_Cfunc_initMacDraw + 46
    7   wdetest                             0x000000000405a160 runtime.asmcgocall + 112
)
terminate called throwing an exceptionSIGABRT: abort
PC=0x7fff8e54ace2 m=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x40e49b0, 0xc820057e98, 0x0)
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/cgocall.go:120 +0x11b fp=0xc820057e50 sp=0xc820057e20
github.com/skelterjohn/go.wde/cocoa._Cfunc_initMacDraw(0xc820096000, 0xfcc, 0xc8200a4000, 0xc800000c4a, 0x0)
    ??:0 +0x39 fp=0xc820057e98 sp=0xc820057e50
github.com/skelterjohn/go.wde/cocoa.init.1()
    /Users/thibautcolar/go/src/github.com/skelterjohn/go.wde/cocoa/cocoa_darwin.go:69 +0x140 fp=0xc820057f08 sp=0xc820057e98
github.com/skelterjohn/go.wde/cocoa.init()
    github.com/skelterjohn/go.wde/cocoa/_obj/_cgo_import.go:1 +0x182 fp=0xc820057f40 sp=0xc820057f08
github.com/skelterjohn/go.wde/init.init()
    /Users/thibautcolar/go/src/github.com/skelterjohn/go.wde/init/init_darwin.go:3 +0x3b fp=0xc820057f48 sp=0xc820057f40
main.init()
    /Users/thibautcolar/go/src/github.com/skelterjohn/go.wde/wdetest/wdetest.go:157 +0x45 fp=0xc820057f50 sp=0xc820057f48
runtime.main()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/proc.go:100 +0x27f fp=0xc820057fa0 sp=0xc820057f50
runtime.goexit()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:1721 +0x1 fp=0xc820057fa8 sp=0xc820057fa0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:1721 +0x1

rax    0x0
rbx    0x6
rcx    0x7fff5fbfe738
rdx    0x0
rdi    0x303
rsi    0x6
rbp    0x7fff5fbfe760
rsp    0x7fff5fbfe738
r8     0x7fff72a0efb8
r9     0x7fff5fbfe1c8
r10    0x7fff8e54ad0a
r11    0x246
r12    0x7fff847a788c
r13    0x420c7b0
r14    0x7fff72a11960
r15    0x7fff5fbfe8b0
rip    0x7fff8e54ace2
rflags 0x246
cs     0x2f
fs     0x10
gs     0x48
exit status 2
sqweek commented 8 years ago

Huh, apparently yes. Looks like initWithNibData was only introduced in 10.8:

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSNib_Class/#//apple_ref/occ/instm/NSNib/initWithNibData%3abundle%3a

Tbh I haven't quite figured out what all the nib business is about, but I'll try to figure out another way to skin this cat.

sqweek commented 8 years ago

@tcolar Can you try the pull request and see if that branch runs on your machine? The oldest I have at my disposal is 10.9.

tcolar commented 8 years ago

Sorry had commented on wrong PR

So I tried this on Lion and it works great.

To be fair Lion is pretty old, it's just that the only mac I own currently can't run anything newer, so that's what I can test my stuff on, short of borrowing someone's newer mac.

So in any case if the NIB stuff is useful and needed, I would be OK with just a branch (or even fork) for this, whatever works best for you.

Thanks.