Bug #5199

ext/tk: RB_GC_GUARD seems to be needed in several places

Added by normalperson (Eric Wong) 9 months ago. Updated 2 months ago.

[ruby-core:39000]
Status:Assigned Start date:08/17/2011
Priority:Normal Due date:
Assignee:nagai (Hidetoshi Nagai) % Done:

0%

Category:ext
Target version:2.0.0
ruby -v:ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]

Description

I noticed the following in ext/tk/tkutil/tkutil.c: rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str))); I don't use or know the Tk ext at all, but the above examples do not appear safe from a GC perspective. Compilers can optimize the original VALUE away entirely so GC can collect. RSTRING_PTR (being a macro,) may also evaluate its arguments multiple times.

History

Updated by mrkn (Kenta Murata) 9 months ago

  • Assignee set to nagai (Hidetoshi Nagai)

Updated by shyouhei (Shyouhei Urabe) 2 months ago

  • Status changed from Open to Assigned

Also available in: Atom PDF