Keep expando ID in sync with our object table by removing the property when
the object is removed from our table.


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6113 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/plugins/npapi/ScriptableInstance.cpp b/plugins/npapi/ScriptableInstance.cpp
index 05547d8..a317185 100644
--- a/plugins/npapi/ScriptableInstance.cpp
+++ b/plugins/npapi/ScriptableInstance.cpp
@@ -362,7 +362,12 @@
   Debug::log(Debug::Debugging) << "freeValue(#ids=" << idCount << ")" << Debug::flush;
   for (int i = 0; i < idCount; ++i) {
 	  Debug::log(Debug::Spam) << " id=" << ids[i] << Debug::flush;
-    localObjects.free(ids[i]);
+    NPObject* obj = localObjects.get(ids[i]);
+    if (!NPN_RemoveProperty(getNPP(), obj, gwtId)) {
+      Debug::log(Debug::Error) << "Unable to remove GWT ID from object " << ids[i] << Debug::flush;
+    } else {
+      localObjects.free(ids[i]);
+    }
   }
 }