<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -886,7 +886,7 @@ rb_smjs_ruby_missing_caller( VALUE args ){
 
 #ifdef ZERO_ARITY_METHOD_IS_PROPERTY
 struct{
-  char* keyname;
+  const char* keyname;
   jsval val;
 }g_last0arity;
 #endif
@@ -1390,8 +1390,8 @@ rbsm_ruby_to_jsobject( JSContext* cx, VALUE obj ){
   
   // Check if we've already converted this object into a JS Object
   if(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP) == Qnil) rb_gv_set(RBSMJS_RUBY_TO_JS_MAP, rb_hash_new());
-  if(rb_funcall(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), rb_intern(&quot;key?&quot;), 1, obj) == Qtrue) {
-    jsval js = (jsval)FIX2INT(rb_hash_aref(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), obj));
+  if(rb_funcall(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), rb_intern(&quot;key?&quot;), 1, rb_obj_id(obj)) == Qtrue) {
+    jsval js = (jsval)FIX2INT(rb_hash_aref(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), rb_obj_id(obj)));
     return JSVAL_TO_OBJECT(js);
   }
 
@@ -1426,7 +1426,7 @@ rbsm_ruby_to_jsobject( JSContext* cx, VALUE obj ){
   JS_SetPrivate( cx, jo, (void*)so );
   JS_DefineFunctions( cx, jo, JSRubyObjectFunctions );
   
-  rb_hash_aset(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), obj, INT2FIX((int)OBJECT_TO_JSVAL(jo)));
+  rb_hash_aset(rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), rb_obj_id(obj), INT2FIX((int)OBJECT_TO_JSVAL(jo)));
   JS_RemoveRoot( cx, &amp;jo );
   
   return jo;
@@ -1441,13 +1441,14 @@ rbsm_class_finalize( JSContext* cx, JSObject* obj ){
   if( so ){
     trace(&quot;rbsm_class_finalize(cx=%x, obj=%x); [count %d -&gt; %d]&quot;, cx, obj, alloc_count_rb2js, --alloc_count_rb2js);
     if( so-&gt;rbobj ){
-      if( JS_GetContextPrivate( cx ) ){
-        VALUE context = RBSMContext_FROM_JsContext( cx );
+      VALUE context = RBSMContext_FROM_JsContext( cx );
+      if( context ){
         VALUE bindings = rb_iv_get( context, RBSMJS_CONTEXT_BINDINGS );
-        if( RTEST( bindings ) ){
-          rb_hash_delete( rb_iv_get( context, RBSMJS_CONTEXT_BINDINGS ), rb_obj_id( so-&gt;rbobj ) );
-        }
-        rb_hash_delete( rb_gv_get(RBSMJS_RUBY_TO_JS_MAP), so-&gt;rbobj);
+        VALUE global_map = rb_gv_get(RBSMJS_RUBY_TO_JS_MAP);
+        if( RTEST( bindings ) )
+          rb_hash_delete( bindings, rb_obj_id( so-&gt;rbobj ) );
+        if( RTEST( global_map ) )
+          rb_hash_delete( global_map, rb_obj_id( so-&gt;rbobj ));
       }
     }
     if( so-&gt;jsv ){</diff>
      <filename>spidermonkey.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>33fe0088cf543663f20feb7bee503fcdb6d6fdbc</id>
    </parent>
  </parents>
  <author>
    <name>Matthew Draper</name>
    <email>matthew@trebex.net</email>
  </author>
  <url>http://github.com/matthewd/ruby-mozjs/commit/0193b23a70db41b030e29cf3827857ef3ef7f999</url>
  <id>0193b23a70db41b030e29cf3827857ef3ef7f999</id>
  <committed-date>2008-08-14T23:03:22-07:00</committed-date>
  <authored-date>2008-08-14T23:03:22-07:00</authored-date>
  <message>Use rb_obj_id() as the key in rb2js hash.

Hashing the real objects seems to make for unhappiness, mostly to do
with the amount of interaction involved upon calling rb_hash_delete,
which occurs in finalize, which is called from SpiderMonkey GC... which
is really not a good time to be trying to call arbitrary methods back in
JS. So, let's not do that.

Also, const-ified a variable to silence a warning.</message>
  <tree>317152ef84c12f4970dda8c83c52993270e7deff</tree>
  <committer>
    <name>Matthew Draper</name>
    <email>matthew@trebex.net</email>
  </committer>
</commit>
