[Rubycocoa-devel 426] Re: trunk, some samples crash(was Re: release)

Back to archive index

Laurent Sansonetti lsans****@apple*****
Sun Oct 29 03:23:37 JST 2006


On Oct 28, 2006, at 5:35 PM, kimura wataru wrote:

> I changed the subject and thread three.
>
> Current RubyCocoa trunk (r1189) has these problems.
>
> (1) sample/RubyTypingTutor crash at dragging
> (2) hisa's MSM2006 tutorial_1 crash evaluate the following script
>    ----
>      win = OSX.NSApp().keyWindow
>      win.setContentView(OSX::NSView.alloc.init)
>    ----
>
> I tried to find the cause of the crashes. I guessed RubyCocoa trunk
> has problem(s) in memory management.
>
> (1) sample/RubyTypingTutor crash at dragging
>
> I modified the code of trunk as the following diff, and (1) not
> occurred. I'll survey more.
>
>
> === framework/src/objc/mdl_objwrapper.m
> ==================================================================
> --- framework/src/objc/mdl_objwrapper.m	(revision 1306)
> +++ framework/src/objc/mdl_objwrapper.m	(local)
> @@ -202,8 +202,8 @@
>    // by "alloc/allocWithZone/new/copy/mutableCopy".
>    if (!NIL_P(result) && rb_obj_is_kind_of(result, objid_s_class())  
> == Qtrue) {
>      if (!OBJCID_DATA_PTR(result)->retained
> -        && strcmp(selector, "alloc") != 0
> -        && strcmp(selector, "allocWithZone:") != 0
> +//        && strcmp(selector, "alloc") != 0
> +//        && strcmp(selector, "allocWithZone:") != 0
>          && strcmp(selector, "new") != 0
>          && strcmp(selector, "copy") != 0
>          && strcmp(selector, "mutableCopy") != 0) {
>

I fixed a bug in apple-unstable related to exceptions forwarding and  
now RubyTypingTutor is working, but it crashes on drag like stable.  
The trace is weird.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xfffffff5
0x0002c7ef in ffi_call ()
(gdb) bt
#0  0x0002c7ef in ffi_call ()
Cannot access memory at address 0x1
Cannot access memory at address 0x5

Putting GC.disable does not help also.  I will investigate.

> (2) hisa's MSM2006 tutorial_1 crash
>
> set NSZombieEnabled environment to "YES" and ran the app, the
> following message was printed.
>
>   Break at '-[_NSZombie methodSignatureForSelector:]' to debug.
>   /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/ 
> osx/objc/oc_im
>   port.rb:16: [BUG] Bus Error
>   ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0]
>
> It seems to the instance variable views (@scratchText, @resultText
> and @outText) was released.
>
>      win = OSX.NSApp().keyWindow
>      win.contentView  # <= insert
>      win.setContentView(OSX::NSView.alloc.init)
>
> After insertion of "win.contentView", superview of the instance
> variables appear into ruby's context, so the views is not released.
>

Interesting, where are the sources of this program?

Thanks,
Laurent



More information about the Rubycocoa-devel mailing list
Back to archive index