Bug 1603041 - Remove WebGLContext from WebGLMemoryTracker before destroying resources r=jgilbert
authorMiko Mynttinen <mikokm@gmail.com>
Fri, 13 Dec 2019 22:13:03 +0000
changeset 507089 0d3256a2c780b9d2ca106d0703f51c2681b67d22
parent 507088 92e21dd89295b9abdb808574fbecc1055a7087f6
child 507090 b2da3109db2c956c0e6a922c529cbdf56df904e1
push id36922
push userncsoregi@mozilla.com
push dateMon, 16 Dec 2019 17:21:47 +0000
treeherdermozilla-central@27d0d6cc2131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1603041
milestone73.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 1603041 - Remove WebGLContext from WebGLMemoryTracker before destroying resources r=jgilbert Differential Revision: https://phabricator.services.mozilla.com/D56758
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -175,23 +175,23 @@ WebGLContext::WebGLContext()
   mLastUseIndex = 0;
 
   mDisableFragHighP = false;
 
   mDrawCallsSinceLastFlush = 0;
 }
 
 WebGLContext::~WebGLContext() {
-  RemovePostRefreshObserver();
-
-  DestroyResourcesAndContext();
   if (NS_IsMainThread()) {
     // XXX mtseng: bug 709490, not thread safe
     WebGLMemoryTracker::RemoveWebGLContext(this);
   }
+
+  RemovePostRefreshObserver();
+  DestroyResourcesAndContext();
 }
 
 template <typename T>
 void ClearLinkedList(LinkedList<T>& list) {
   while (!list.isEmpty()) {
     list.getLast()->DeleteOnce();
   }
 }