[MacRuby-devel] [MacRuby] #604: EXC_BAD_ACCESS while opening stream

MacRuby ruby-noreply at macosforge.org
Tue Mar 30 19:43:01 PDT 2010


#604: EXC_BAD_ACCESS while opening stream
-----------------------------------+----------------------------------------
 Reporter:  jakub.suder@…          |        Owner:  lsansonetti@…        
     Type:  defect                 |       Status:  closed               
 Priority:  critical               |    Milestone:  MacRuby 0.6          
Component:  MacRuby                |   Resolution:  invalid              
 Keywords:                         |  
-----------------------------------+----------------------------------------
Changes (by martinlagardette@…):

  * status:  new => closed
  * resolution:  => invalid
  * milestone:  => MacRuby 0.6


Comment:

 OK, we found the culprit.

 The problem is that `ASIHTTPRequest` defines `ASIInputStream`, which
 inherits from `NSObject` (and not `NSInputStream` because it's a little
 bit complicated).

 To overcome this limitation and simulate inheriting `NSInputStream`,
 `ASIInputStream` forwards all unknown invocations to its internal
 `NSInputStream`.

 However, since MacRuby defines `#open` on `Kernel` (included by `Object`),
 when `-open` is sent to `ASIInputStream`, the Obj-C runtime considers the
 object knows how to respond to this message, which is why instead of
 asking the object if a message forwarding is needed, it just sends it
 `-open` (aka our `rb_f_open`).

 The fix is very easy, and I am going to mail the author of ASIHTTPRequest
 just in case. Open `ASIInputStream.m`, and add the following between the
 implementations of `-read:maxLength:` and `methodSignatureForSelector:`:
 {{{
 - (void)open
 {
     [stream open];
 }
 }}}

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



More information about the MacRuby-devel mailing list