From c8c257f8c84c163354a2b3ba7c97bd76f2700443 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 1 Mar 2014 14:08:53 -0500 Subject: [PATCH] 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... --- uitask_darwin.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/uitask_darwin.go b/uitask_darwin.go index 4417528..3a6d633 100644 --- a/uitask_darwin.go +++ b/uitask_darwin.go @@ -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)