Projects

Ticket #255 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

NSArray.new(["elem"]) segfaults

Reported by: thilo@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.5
Component: MacRuby Keywords: NSArray constructor
Cc:

Description (last modified by mattaimonetti@…) (diff)

NSArray.new(["elem"])

causes a segmentation fault with macruby 0.4

Change History

Changed 3 years ago by mattaimonetti@…

  • description modified (diff)
my_array = Array.new(['elem'])
}}

or even better:

{{{
my_array = ['eleme']
}}

}}}

Changed 3 years ago by thilo@…

Sure this is the preferred way. Just discovered that while playing around with mixing Obj-C and MacRuby and thought you might wanna know this.

Changed 2 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.5

Doesn't seem to crash anymore with trunk.

$ ./miniruby -e 'NSArray.new(["elem"])'
can't modify frozen/immutable array (RuntimeError)

The exception is because we will firstly allocate an NSArray instance then #initialize will try to modify it, and it fails since the object is immutable. Not sure if it's meaningful to fix that.

Note: See TracTickets for help on using tickets.