[MacRuby-devel] [MacRuby] #249: Attempting to modify instances of NSString or NSArray causes crash

MacRuby ruby-noreply at macosforge.org
Wed May 6 14:06:04 PDT 2009


#249: Attempting to modify instances of NSString or NSArray causes crash
---------------------------------+------------------------------------------
 Reporter:  jesper@…             |       Owner:  lsansonetti@…        
     Type:  defect               |      Status:  new                  
 Priority:  blocker              |   Milestone:                       
Component:  MacRuby              |    Keywords:                       
---------------------------------+------------------------------------------

Comment(by lsansonetti@…):

 Thanks for the report, this is likely a bug in the YARV #<< optimization.
 We do check for mutability before doing any destructive operations.

 {{{
 $ macruby -e 's=NSString.string; s.strip!'
 -e:1:in `strip!': can't modify immutable string (RuntimeError)
         from -e:1:in `<main>'
 }}}

 Also, I noticed that the check doesn't work for NSArray in 64-bit.

 {{{
 $ arch -i386 macruby -e "a = NSArray.array; a.clear"
 -e:1:in `clear': can't modify frozen/immutable array (RuntimeError)
         from -e:1:in `<main>'
 $ arch -x86_64 macruby -e "a = NSArray.array; a.clear"
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/249#comment:2>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list