[MacRuby-devel] [MacRuby] #312: reopening a class and setNeedsDisplay: segfault
MacRuby
ruby-noreply at macosforge.org
Thu Jun 10 17:00:03 PDT 2010
#312: reopening a class and setNeedsDisplay: segfault
-------------------------------------+--------------------------------------
Reporter: mattaimonetti@… | Owner: lsansonetti@…
Type: defect | Status: closed
Priority: critical | Milestone: MacRuby 0.5
Component: MacRuby | Resolution: invalid
Keywords: |
-------------------------------------+--------------------------------------
Changes (by martinlagardette@…):
* status: new => closed
* resolution: => invalid
Comment:
Also, I would suggest doing something more Cocoa-y, to make sure `CALayer`
`-init` is called:
{{{
#!ruby
framework 'Cocoa'
class ImageLayer < CALayer
def initialize(file_name)
if init
@filename = file_name
end
self
end
end
ImageLayer.new("test").setNeedsDisplay
}}}
This will actually call `CALayer`'s `-init`, which I think is not called
at all in your 1st and 3rd example, hence the crash in `-setNeedsDisplay`,
the `CALayer` not being initalized properly.
In the second example you linked, `initialize` is never called, so `-init`
is actually called and that's why it works. You can see by doing:
{{{
#!ruby
framework 'Cocoa'
class ImageLayer < CALayer; def initialize; super(); p "rb init"; end; end
ImageLayer.new.setNeedsDisplay # => nil
}}}
{{{
$> macruby t.rb
$>
}}}
I'll close this bug, but feel free to re-open it if I'm wrong / if I
missed something :-)
--
Ticket URL: <http://www.macruby.org/trac/ticket/312#comment:2>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list