Auto merge of #6131 - glennw:jquery-exit-fix, r=jdm

This fixes a hang found while testing the jQuery test suite.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6131)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-05-19 21:44:45 -05:00
commit c51e9f0455
7 changed files with 74 additions and 21 deletions

View file

@ -94,7 +94,13 @@ impl PaintListener for Box<CompositorProxy+'static+Send> {
fn get_graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata> {
let (chan, port) = channel();
self.send(Msg::GetGraphicsMetadata(chan));
port.recv().unwrap()
// If the compositor is shutting down when a paint task
// is being created, the compositor won't respond to
// this message, resulting in an eventual panic. Instead,
// just return None in this case, since the paint task
// will exit shortly and never actually be requested
// to paint buffers by the compositor.
port.recv().unwrap_or(None)
}
fn assign_painted_buffers(&mut self,