From: "nagai (Hidetoshi Nagai)" <nagai@ai.kyutech.ac.jp>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:55524] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
Date: Mon, 17 Jun 2013 14:20:28 +0900 [thread overview]
Message-ID: <redmine.journal-39990.20130617142022@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-5199.20110817113159@ruby-lang.org
Issue #5199 has been updated by nagai (Hidetoshi Nagai).
nobu (Nobuyoshi Nakada) wrote:
> Quick patch.
>
> 2.0 has GC safe functions, rb_sprintf() with PRIsVALUE, rb_intern_str(), and so on.
Nakada-san, please commit the patch.
----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-39990
Author: normalperson (Eric Wong)
Status: Assigned
Priority: Normal
Assignee: nagai (Hidetoshi Nagai)
Category: ext
Target version: current: 2.1.0
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]
Backport:
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.
--
http://bugs.ruby-lang.org/
next prev parent reply other threads:[~2013-06-17 5:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-17 2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
2011-08-18 6:54 ` [ruby-core:39016] [Ruby 1.9 - Bug #5199] " Kenta Murata
2013-02-17 10:06 ` [ruby-core:52367] [ruby-trunk " ko1 (Koichi Sasada)
2013-02-18 4:51 ` [ruby-core:52432] " Hidetoshi NAGAI
2013-02-20 3:54 ` [ruby-core:52553] " nobu (Nobuyoshi Nakada)
2013-02-21 3:31 ` [ruby-core:52608] " jonforums (Jon Forums)
2013-06-17 5:20 ` nagai (Hidetoshi Nagai) [this message]
2013-06-17 8:10 ` [ruby-core:55526] " nobu (Nobuyoshi Nakada)
2014-01-12 6:31 ` [ruby-core:59701] " Tomoyuki, Chikanaga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-39990.20130617142022@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).