diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-19 08:19:13 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-19 08:19:13 +0000 |
commit | e0a0edf548ec518651f2571ac02a2716855b50d8 (patch) | |
tree | 2e53658ce0d921abe076c98a0b439a25e77c90ce /time.c | |
parent | 5f00b99975099224a19cf85beb8c51ed8b1cd96c (diff) | |
download | ruby-e0a0edf548ec518651f2571ac02a2716855b50d8.tar.gz |
time.c: freeze and preserve marshal-loaded time zone
We need to prevent vtm.zone from pointing to a GC-ed string buffer.
The rb_copy_generic_ivar call misses it because get_attr deleted it.
Thanks to nobu for the rb_str_new_frozen suggestion.
* time.c (time_mload): freeze and preserve marshal-loaded time zone
* test/ruby/test_time.rb: add test for GC on loaded object
[Bug #9652]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -4827,7 +4827,9 @@ end_submicro: ; time_fixoff(time); } if (!NIL_P(zone)) { + zone = rb_str_new_frozen(zone); tobj->vtm.zone = RSTRING_PTR(zone); + rb_ivar_set(time, id_zone, zone); } return time; |