Fixed a minor startup failure on Mac OS X; now for a big one: apparently the thread that calls -[NSApplication run] is NOT the main thread...

This commit is contained in:
Pietro Gagliardi 2014-03-01 14:08:53 -05:00
parent b6b8ee6a82
commit c8c257f8c8
1 changed files with 3 additions and 1 deletions

View File

@ -100,7 +100,9 @@ func mainThread() {
mtret <- fmt.Errorf("error adding NSApplication delegate uitask: method (to do UI tasks): %v", err)
return
}
appDelegate := objc_new(objc_getClass(_goAppDelegate))
// TODO using objc_new() causes a segfault; find out why
// TODO make alloc followed by init (I thought NSObject provided its own init?)
appDelegate := objc_alloc(objc_getClass(_goAppDelegate))
objc_setDelegate(_NSApp, appDelegate)
// and that's it, really
C.objc_msgSend_noargs(_NSApp, _run)