[MacRuby] #1129: Setting value of dereferenced pointer properties fails silently
MacRuby
ruby-noreply at macosforge.org
Wed Jan 26 14:45:57 PST 2011
#1129: Setting value of dereferenced pointer properties fails silently
---------------------------------+------------------------------------------
Reporter: dev@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone: MacRuby 1.0
Component: MacRuby | Keywords:
---------------------------------+------------------------------------------
Orignal ML thread: http://lists.macosforge.org/pipermail/macruby-
devel/2011-January/006944.html
I suggest we either make it work or raise.
For:
{{{
- (BOOL)isPartialStringValid:(NSString **)partialStringPtr
proposedSelectedRange:(NSRangePointer)proposedSelRangePtr
originalString:(NSString *)origString
originalSelectedRange:(NSRange)origSelRange
errorDescription:(NSString **)error
}}}
When subclassing NSFormatter in ruby, I define the method as:
{{{
def isPartialStringValid(partialStringPtr,
proposedSelectedRange:proposedSelRangePtr,
originalString:origString,
originalSelectedRange:origSelRange,
errorDescription:error)
}}}
When implementing the Cocoa Programming exercises in MacRuby, I ran across
the following situation:
At some point in that method definition, in the original code, Aaron sets
the range properties directly:
{{{
proposedSelRangePtr->location = [*partialStringPtr length];
proposedSelRangePtr->length = [match length] -
proposedSelRangePtr->location;
}}}
Initially, I did similar in MacRuby
{{{
proposedSelRangePtr[0].location = partialStringPtr[0].length
proposedSelRangePtr[0].length = match.length -
proposedSelRangePtr[0].location
}}}
This has no effect. It does not raise, but the values go unchanged. I can
NSLog the range values before and after and they're the same.
--
Ticket URL: <http://www.macruby.org/trac/ticket/1129>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list