bug 1196460 - remove proxy's ids when they are destroyed r=surkov
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Thu, 27 Aug 2015 17:24:13 -0400
changeset 294998 be192df7732ea1d5c2d31c20b618145fc029cc67
parent 294997 4ea6b5620ce4148d798c753611ab596962168e66
child 294999 a2e610b46e85597e865a601c5d3f6c381702fbba
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1196460
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1196460 - remove proxy's ids when they are destroyed r=surkov
accessible/windows/msaa/AccessibleWrap.cpp
accessible/windows/msaa/AccessibleWrap.h
accessible/windows/msaa/Platform.cpp
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -55,18 +55,16 @@ const uint32_t USE_ROLE_STRING = 0;
 //#define DEBUG_LEAKS
 
 #ifdef DEBUG_LEAKS
 static gAccessibles = 0;
 #endif
 
 #ifdef _WIN64
 IDSet AccessibleWrap::sIDGen;
-
-static const uint32_t kNoID = 0;
 #endif
 
 static const int32_t kIEnumVariantDisconnected = -1;
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
--- a/accessible/windows/msaa/AccessibleWrap.h
+++ b/accessible/windows/msaa/AccessibleWrap.h
@@ -172,16 +172,21 @@ public: // construction, destruction
    * Find an accessible by the given child ID in cached documents.
    */
   Accessible* GetXPAccessibleFor(const VARIANT& aVarChild);
 
   virtual void GetNativeInterface(void **aOutAccessible) override;
 
   static IDispatch* NativeAccessible(Accessible* aAccessible);
 
+#ifdef _WIN64
+  uint32_t GetExistingID() const { return mID; }
+  static const uint32_t kNoID = 0;
+#endif
+
 protected:
   virtual ~AccessibleWrap();
 
 #ifdef _WIN64
   uint32_t mID;
 #endif
 
   /**
--- a/accessible/windows/msaa/Platform.cpp
+++ b/accessible/windows/msaa/Platform.cpp
@@ -54,16 +54,27 @@ void
 a11y::ProxyDestroyed(ProxyAccessible* aProxy)
 {
   AccessibleWrap* wrapper =
     reinterpret_cast<AccessibleWrap*>(aProxy->GetWrapper());
   MOZ_ASSERT(wrapper);
   if (!wrapper)
     return;
 
+  auto doc =
+    static_cast<DocProxyAccessibleWrap*>(WrapperFor(aProxy->Document()));
+#ifdef _WIN64
+  uint32_t id = wrapper->GetExistingID();
+  if (id != AccessibleWrap::kNoID) {
+    doc->RemoveID(id);
+  }
+#else
+  doc->RemoveID(-reinterpret_cast<int32_t>(wrapper));
+#endif
+
   wrapper->Shutdown();
   aProxy->SetWrapper(0);
   wrapper->Release();
 }
 
 void
 a11y::ProxyEvent(ProxyAccessible*, uint32_t)
 {