mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
gfx: Don't crash if there is no graphics metadata.
This commit is contained in:
parent
faaf1f9c5a
commit
e5276f06e3
1 changed files with 14 additions and 5 deletions
|
@ -291,8 +291,6 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
||||||
let render_backend = self.opts.render_backend;
|
let render_backend = self.opts.render_backend;
|
||||||
let native_graphics_context = self.compositor.get_graphics_metadata().map(
|
let native_graphics_context = self.compositor.get_graphics_metadata().map(
|
||||||
|md| NativePaintingGraphicsContext::from_metadata(&md));
|
|md| NativePaintingGraphicsContext::from_metadata(&md));
|
||||||
let native_graphics_context = native_graphics_context.expect("need native graphics context");
|
|
||||||
let native_graphics_context = Some(native_graphics_context);
|
|
||||||
let font_ctx_info = FontContextInfo {
|
let font_ctx_info = FontContextInfo {
|
||||||
backend: self.opts.render_backend,
|
backend: self.opts.render_backend,
|
||||||
needs_font_list: false,
|
needs_font_list: false,
|
||||||
|
@ -309,13 +307,24 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
||||||
let render_data = match render_msg {
|
let render_data = match render_msg {
|
||||||
WorkerRender(render_data) => render_data,
|
WorkerRender(render_data) => render_data,
|
||||||
WorkerUnusedBuffer(buffer) => {
|
WorkerUnusedBuffer(buffer) => {
|
||||||
buffer_map.insert(native_graphics_context.get_ref(), buffer);
|
match native_graphics_context {
|
||||||
|
None => {}
|
||||||
|
Some(ref native_graphics_context) => {
|
||||||
|
buffer_map.insert(native_graphics_context,
|
||||||
|
buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
WorkerExit(tx) => {
|
WorkerExit(tx) => {
|
||||||
// Cleanup and tell the RenderTask we're done
|
// Cleanup and tell the RenderTask we're done
|
||||||
buffer_map.clear(native_graphics_context.get_ref());
|
match native_graphics_context {
|
||||||
drop(native_graphics_context.take_unwrap());
|
None => {}
|
||||||
|
Some(native_graphics_context) => {
|
||||||
|
buffer_map.clear(
|
||||||
|
&native_graphics_context);
|
||||||
|
}
|
||||||
|
}
|
||||||
tx.send(());
|
tx.send(());
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue