kimura wataru
kimur****@i*****
Sun Oct 29 00:35:56 JST 2006
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) { (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. -- kimura wataru