Restore exit after load command line flag.

Also updates glutin with a crash fix that was exposed by this patch.
This commit is contained in:
Glenn Watson 2015-07-20 08:28:19 +10:00
parent 2f4bdc6ad6
commit 4f28c93f40
6 changed files with 24 additions and 12 deletions

View file

@ -412,7 +412,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.got_load_complete_message = true;
// If we're painting in headless mode, schedule a recomposite.
if opts::get().output_file.is_some() {
if opts::get().output_file.is_some() || opts::get().exit_after_load {
self.composite_if_necessary(CompositingReason::Headless);
}
@ -1376,8 +1376,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
if !self.is_ready_to_paint_image_output() {
return None
}
},
_ => {}
}
CompositeTarget::Window => {
if opts::get().exit_after_load && !self.is_ready_to_paint_image_output() {
return None
}
}
}
let (framebuffer_ids, texture_ids) = match target {
@ -1414,15 +1418,17 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let path = opts::get().output_file.as_ref().unwrap();
let res = png::store_png(&mut img, &path);
assert!(res.is_ok());
debug!("shutting down the constellation after generating an output file");
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::Exit).unwrap();
self.shutdown_state = ShutdownState::ShuttingDown;
None
}
};
if opts::get().output_file.is_some() || opts::get().exit_after_load {
debug!("shutting down the constellation (after generating an output file or exit flag specified)");
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::Exit).unwrap();
self.shutdown_state = ShutdownState::ShuttingDown;
}
// Perform the page flip. This will likely block for a while.
self.window.present();