Jonathan Paisley
jp-ww****@dcs*****
Thu Jun 8 06:35:07 JST 2006
> Ah yes, this is a known-issue. The NSOutlineView datasource model > expects this, so I think this should be done at the application > level, either using that NSOutlineViewable module you wrote or > explicitly make sure the Ruby proxies are 'retained'. Yep, I agree with that. I hadn't intended to give the impression that I thought it was a bug in NSOutlineView - just a bit of a pain sometimes! :) > Sorry I did not understand what you mean with "automatic support > for dereferencing the proxy when it comes in as an argument to a > ruby method", could you elaborate a bit more? Yep (I realise that wasn't very clear): The NSOutlineViewable module overrides/implements 'to_nsobj' which creates an NSObject slave for the Ruby data model object. Therefore, the conversion from Ruby object to slave is transparent (since RubyCocoa core uses 'to_nsobj'). However, conversion back requires accessing the 'slave' attribute. The "automatic support" I was talking about would notice the proxy object when constructing the ruby arguments from an objc method invocation and pass through the slave instead of the proxy. Then, to the user, it would be fully transparent after Since writing that code I've decided that the 'ObjectSpace._id2ref' stuff is unnecessary. > # I have an idea on how to fix this at the Ruby interpreter level, > which should be elegant and would allow us to not use proxies > anymore, but this requires some work. Can you indicate the rough approach you were thinking of? Cheers, Jonathan