On 2014-11-04 10:07, Christian Schneider wrote:
Ok, some more info:

I changed the mapping in tableview.d to:

void setDoubleAction(void __selector(ObjcObject))
[setDoubleAction:] ;

This should be the way to do it. Now in the implementation of the

      void doubleClickAction(ObjcObject sender) {
          NSLog("double click action") ;
          NSLog("the sender: %@", sender) ;

This works fine and prints the log:  2014-11-04 10:01:57.967
tableview[9988:507] the sender: <NSTableView: 0x7f8309f156b0>

But now I would like to do something with this sender, like I do
often in an Objective-C project:

NSTableView tableView = cast(NSTableView)sender ;

I get a  EXC_BAD_ACCESS (SIGSEGV) on this line. Only when I
replace both ObjcObject with NSObject (in tableview.d, the
mapping, and the target action) this cast works. I might be
missing something obvious here.

This should be fixed now in my forks [1] [2]. Note, I've also replaced the selector syntax, [foo], with a compiler recognized UDA, @selector("foo").

[1] https://github.com/jacob-carlborg/dmd/tree/d-objc
[2] https://github.com/jacob-carlborg/druntime/tree/d-objc

/Jacob Carlborg

Reply via email to