shiny/driver/gldriver: care for NSWindow lifetime

Two changes. First, create the NSWindow on the main application
thread. I have not found any Cocoa documentation that says this is
necessary, but when in doubt in Cocoa do it on the main thread.

Second, avoid autoreleasing the NSWindow. We are not maintaining any
strong references to it (only the reference from inside the NSView),
so cleaning up the memory is our job. Added a TODO, as when Shiny has
a concept of closing windows, we should free the NSWindow.

Fixes golang/go#12221

Change-Id: I28098228fd1ab89c263634b1903a34571ea2d595
Reviewed-on: https://go-review.googlesource.com/13741
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
1 file changed