ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Kenta Murata <muraken@gmail.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:39016] [Ruby 1.9 - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
Date: Thu, 18 Aug 2011 15:54:29 +0900	[thread overview]
Message-ID: <redmine.journal-20321.20110818155426@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-5199.20110817113159@ruby-lang.org


Issue #5199 has been updated by Kenta Murata.

Assignee set to Hidetoshi Nagai


----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
http://redmine.ruby-lang.org/issues/5199

Author: Eric Wong
Status: Open
Priority: Normal
Assignee: Hidetoshi Nagai
Category: ext
Target version: 1.9.x
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]


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://redmine.ruby-lang.org

  reply	other threads:[~2011-08-18  6:38 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 ` Kenta Murata [this message]
2013-02-17 10:06 ` [ruby-core:52367] [ruby-trunk - Bug #5199] " 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 ` [ruby-core:55524] " nagai (Hidetoshi Nagai)
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-20321.20110818155426@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).