summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-16 04:43:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-16 04:43:28 +0000
commit2ba2dba5bef7ac397bda797c77ad3e824a5210c3 (patch)
tree0c3c7dd0b48f45955d59d0943f1cd50c0b8b8ac4 /variable.c
parenteddaabb1654e4b599a981a2f8bf0b65547b6d51e (diff)
* variable.c (rb_global_entry): not add global entry until
initialized to avoid accessing it while GC. [ruby-dev:18514] * variable.c (rb_alias_variable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/variable.c b/variable.c
index 4d3944d..f63f543 100644
--- a/variable.c
+++ b/variable.c
@@ -354,7 +354,6 @@ rb_global_entry(id)
if (!st_lookup(rb_global_tbl, id, &entry)) {
struct global_variable *var;
entry = ALLOC(struct global_entry);
- st_add_direct(rb_global_tbl, id, entry);
var = ALLOC(struct global_variable);
entry->id = id;
entry->var = var;
@@ -366,6 +365,7 @@ rb_global_entry(id)
var->block_trace = 0;
var->trace = 0;
+ st_add_direct(rb_global_tbl, id, entry);
}
return entry;
}
@@ -768,8 +768,8 @@ rb_alias_variable(name1, name2)
entry2 = rb_global_entry(name2);
if (!st_lookup(rb_global_tbl, name1, &entry1)) {
entry1 = ALLOC(struct global_entry);
- st_add_direct(rb_global_tbl, name1, entry1);
entry1->id = name1;
+ st_add_direct(rb_global_tbl, name1, entry1);
}
else if (entry1->var != entry2->var) {
struct global_variable *var = entry1->var;