diff --git a/delegate_darwin.go b/delegate_darwin.go index 7f14d04..8fa8097 100644 --- a/delegate_darwin.go +++ b/delegate_darwin.go @@ -64,7 +64,7 @@ func mkAppDelegate() error { if err != nil { return fmt.Errorf("error adding NSApplication delegate buttonClicked: method (to handle button clicks): %v", err) } - appDelegate = objc_new(objc_getClass(_goAppDelegate)) + appDelegate = C.objc_msgSend_noargs(objc_getClass(_goAppDelegate), _new) return nil } diff --git a/dialog_darwin.go b/dialog_darwin.go index 677b153..302053c 100644 --- a/dialog_darwin.go +++ b/dialog_darwin.go @@ -31,7 +31,7 @@ func _msgBox(primarytext string, secondarytext string, style uintptr, button0 st ret := make(chan struct{}) defer close(ret) uitask <- func() { - box := objc_new(_NSAlert) + box := C.objc_msgSend_noargs(_NSAlert, _new) C.objc_msgSend_id(box, _setMessageText, toNSString(primarytext)) C.objc_msgSend_id(box, _setInformativeText, toNSString(secondarytext)) objc_msgSend_uint(box, _setAlertStyle, style) diff --git a/listbox_darwin.go b/listbox_darwin.go index acb68df..19e8523 100644 --- a/listbox_darwin.go +++ b/listbox_darwin.go @@ -85,7 +85,7 @@ var ( ) func newListboxArray() C.id { - array := objc_new(_NSArrayController) + array := C.objc_msgSend_noargs(_NSArrayController, _new) C.objc_msgSend_bool(array, _setAutomaticallyRearrangesObjects, C.BOOL(C.NO)) return array } diff --git a/objc_darwin.go b/objc_darwin.go index 76fbb54..8f8ef2c 100644 --- a/objc_darwin.go +++ b/objc_darwin.go @@ -43,10 +43,6 @@ func objc_alloc(class C.id) C.id { return C.objc_msgSend_noargs(class, _alloc) } -func objc_new(class C.id) C.id { - return C.objc_msgSend_noargs(class, _new) -} - func objc_release(obj C.id) { C.objc_msgSend_noargs(obj, _release) } diff --git a/uitask_darwin.go b/uitask_darwin.go index 2d13b6e..fa2aa75 100644 --- a/uitask_darwin.go +++ b/uitask_darwin.go @@ -41,7 +41,7 @@ func ui(main func()) error { go func() { for f := range uitask { // we need to make an NSAutoreleasePool, otherwise we get leak warnings on stderr - pool := objc_new(_NSAutoreleasePool) + pool := C.objc_msgSend_noargs(_NSAutoreleasePool, _new) fp := C.objc_msgSend_ptr(_NSValue, _valueWithPointer, unsafe.Pointer(&f)) C.objc_msgSend_sel_id_bool(