Ensure render and layout tasks get destructed before main thread finishes

Fixes #1097.
This commit is contained in:
Daniel Hedlund 2013-12-13 17:42:52 -08:00
parent 44404766da
commit e7a591a7e1
9 changed files with 146 additions and 90 deletions

View file

@ -207,18 +207,23 @@ impl LayoutTask {
render_chan: RenderChan<AbstractNode<()>>,
img_cache_task: ImageCacheTask,
opts: Opts,
profiler_chan: ProfilerChan) {
profiler_chan: ProfilerChan,
shutdown_chan: Chan<()>) {
spawn_with!(task::task(), [port, constellation_chan, script_chan,
render_chan, img_cache_task, profiler_chan], {
let mut layout = LayoutTask::new(id,
port,
constellation_chan,
script_chan,
render_chan,
img_cache_task,
&opts,
profiler_chan);
layout.start();
render_chan, img_cache_task, profiler_chan, shutdown_chan], {
{ // Ensures LayoutTask gets destroyed before we send the shutdown message
let mut layout = LayoutTask::new(id,
port,
constellation_chan,
script_chan,
render_chan,
img_cache_task,
&opts,
profiler_chan);
layout.start();
}
shutdown_chan.send(());
});
}