Avoid accessing node global during Node's destructor.

This commit is contained in:
Josh Matthews 2019-12-19 18:15:30 -05:00
parent 3e95efdea6
commit 1449bac0e1
3 changed files with 42 additions and 13 deletions

View file

@ -1403,7 +1403,9 @@ impl Window {
// We tear down the active document, which causes all the attached
// nodes to dispose of their layout data. This messages the layout
// thread, informing it that it can safely free the memory.
self.Document().upcast::<Node>().teardown();
self.Document()
.upcast::<Node>()
.teardown(self.layout_chan());
// Tell the constellation to drop the sender to our message-port router, if there is any.
self.upcast::<GlobalScope>().remove_message_ports_router();