Bug 1431787 - Followup to avoid the call to wr_api_get_namespace from the WebRenderAPI destructor. r=me a=RyanVM
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 19 Jan 2018 16:42:40 -0500
changeset 722801 6bb6f3b25f9fe7ae1ef5092496776a891250cbb6
parent 722774 8cde429207f383998be64ecb8e0741997605196a
child 722802 e93d95b62b744d24236744e8d0e66033c1649ab5
child 722848 f448a063c158e51c5f7145197865696105b2d617
child 722851 447b906be65b7ad5a6c6f2f9d6a00ebeeaa6cf94
child 722891 8b5b9799e84cb4ea0b05575d7bb8218711a106c0
child 722892 919b909527493a5601173a27828bff4c727c3efe
child 722894 794b001dbd85f7b0c2f6b9f27faba3c365c7cf98
child 722895 b8739077f3f00aafdcf5943ecde3b0f32933f481
child 722896 46d15ad93992434efcc8d986ff255cc5b6eaf1c3
child 722932 5c8013cc62111c137f79e75c6f50e9cbe159f1ff
child 722933 a0e5c3c9fcd7f3a0d29067545f7ef79ea7735635
child 722980 ece91b7c2b5fbb9837c1a4830b3b891cea6ad6d7
child 723023 dc7c22c9b1b76fcb225d1e7012bb327c6d9dfb50
child 723071 ff178682bab48d3ffb4b4be2f2b08aaec68742e6
child 723251 ff9dec21d6b9ffac3660ee0a489658cb998df27f
child 723851 476c279c12d361fcb09869a1b4c67834021edd50
child 724279 81ec81405b5aa08ae673672af150d071683c1bc2
child 747514 58b2fd2e4dd140b886ce9e7dc5dd55485c8eacd4
child 747516 8c6927076a453a1eccee5396d81f41db4cf2f847
child 748173 40645322613bd4a163c1f367b557fe169fa38a35
push id96259
push userbmo:tushararora.cs@gmail.com
push dateSat, 20 Jan 2018 10:11:59 +0000
reviewersme, RyanVM
bugs1431787
milestone59.0a1
Bug 1431787 - Followup to avoid the call to wr_api_get_namespace from the WebRenderAPI destructor. r=me a=RyanVM Landing on a CLOSED TREE because this needs to go to beta to fix the build. MozReview-Commit-ID: Askd7fgnn3E
gfx/webrender_bindings/WebRenderAPI.cpp
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -304,19 +304,30 @@ WebRenderAPI::~WebRenderAPI()
     RenderThread::Get()->SetDestroyed(GetId());
 
     layers::SynchronousTask task("Destroy WebRenderAPI");
     auto event = MakeUnique<RemoveRenderer>(&task);
     RunOnRenderThread(Move(event));
     task.Wait();
   }
 
+  // wr_api_get_namespace cannot be marked destructor-safe because it has a
+  // return value, and we can't call it if MOZ_BUILD_WEBRENDER is not defined
+  // because it's not destructor-safe. So let's just ifdef around it. This is
+  // basically a hack to get around compile-time warnings, this code never runs
+  // unless MOZ_BUILD_WEBRENDER is defined anyway.
+#ifdef MOZ_BUILD_WEBRENDER
+  wr::WrIdNamespace ns = GetNamespace();
+#else
+  wr::WrIdNamespace ns{0};
+#endif
+
   // Clean up any resources the blob image renderer is holding onto that
   // can no longer be used once this WR API instance goes away.
-  ClearBlobImageResources(GetNamespace());
+  ClearBlobImageResources(ns);
 
   wr_api_delete(mDocHandle);
 }
 
 void
 WebRenderAPI::SendTransaction(TransactionBuilder& aTxn)
 {
   wr_api_send_transaction(mDocHandle, aTxn.Raw());