summaryrefslogtreecommitdiff
path: root/darwintest/newtypes.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-28 17:20:22 -0500
committerPietro Gagliardi <[email protected]>2014-02-28 17:25:04 -0500
commit56a436bc804539db271471b357c5b3e5d6465238 (patch)
treef3de5f741c82aaf58165f65e3140920a4b01b081 /darwintest/newtypes.go
parent6982912a58f03b7974a8718e7cb11a3cd9e877e4 (diff)
Changed the main thread signaling to use NSObject's performSelectorOnMainThread: functionality, which settles that. NSString requires an autorelease pool; in testing, so does NSValue, which we are eventually going to use. NSAutoreleasePool's docs suggest we should create a temporary pool for things running in other threads, but then we have to release it... but I guess we're waiting for the function to complete on other platforms already, so no big deal here.
Diffstat (limited to 'darwintest/newtypes.go')
-rw-r--r--darwintest/newtypes.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/darwintest/newtypes.go b/darwintest/newtypes.go
index 7bcb898..4bb04f7 100644
--- a/darwintest/newtypes.go
+++ b/darwintest/newtypes.go
@@ -51,14 +51,9 @@ func buttonClicked(self C.id, sel C.SEL, sender C.id) {
}
//export gotNotification
-func gotNotification(self C.id, sel C.SEL, note C.id) {
- data := C.objc_msgSend_noargs(note,
- sel_getUid("userInfo"))
- val := C.objc_msgSend_id(data,
- sel_getUid("objectForKey:"),
- notekey)
+func gotNotification(self C.id, sel C.SEL, object C.id) {
source := (*C.char)(unsafe.Pointer(
- C.objc_msgSend_noargs(val,
+ C.objc_msgSend_noargs(object,
sel_getUid("UTF8String"))))
fmt.Println("got notification from %s",
C.GoString(source))