Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: runtime/vm/pages.cc

Issue 2650583006: Fix race in deletion of native message handlers (fixes #28484). (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/message_handler.cc ('K') | « runtime/vm/message_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 450af9a63a0551bbb980258503f3c49964e9bac6..c8f24daf5f0bcbf35b30aa2bc6310aff38b504eb 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -89,8 +89,16 @@ HeapPage* HeapPage::Allocate(intptr_t size_in_words, PageType type) {
void HeapPage::Deallocate() {
- // The memory for this object will become unavailable after the delete below.
+ // For a regular heap pages, the memory for this object will become
+ // unavailable after the delete below.
+ bool is_embedder_allocated = embedder_allocated();
delete memory_;
+
+ // For a heap page from a snapshot, the HeapPage object lives in the malloc
+ // heap rather than the page itself.
+ if (is_embedder_allocated) {
+ free(this);
Florian Schneider 2017/01/24 02:06:07 Maybe change this to new/delete instead of malloc/
rmacnak 2017/01/24 03:28:36 Trying this out, I see the original reason this us
+ }
}
« runtime/vm/message_handler.cc ('K') | « runtime/vm/message_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698