diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-04 13:29:08 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-11 20:23:41 -0800 |
commit | 43397cefec97fdba38976f4a8e3e693c5dadfc61 (patch) | |
tree | 1cb231fa9644c3765f1794a8702e175e634c382b /src/main.rs | |
parent | ce32eee0999b60842c63cb7607b8bf9319242d5c (diff) | |
download | alacritty-43397cefec97fdba38976f4a8e3e693c5dadfc61.tar.gz alacritty-43397cefec97fdba38976f4a8e3e693c5dadfc61.zip |
Borrow glutin::Window instead of using Arc
glutin::Window is not threadsafe; putting it into an Arc is
misleading (although the glutin::Window type claims to be Send + Sync).
The reference was just needed on the main thread anyway, so it's better
to just pass a ref around directly.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index 80389b2b..c619a66b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -183,7 +183,6 @@ fn main() { let signal_flag = Flag::new(false); let terminal = Arc::new(FairMutex::new(terminal)); - let window = Arc::new(window); // Setup the rsize callback for osx let terminal_ref = terminal.clone(); @@ -215,7 +214,7 @@ fn main() { // Wraps a renderer and gives simple draw() api. let mut display = Display::new( - window.clone(), + &window, renderer, glyph_cache, render_timer, @@ -290,8 +289,8 @@ impl config::OnConfigReload for ConfigHandler { } } -struct Display { - window: Arc<glutin::Window>, +struct Display<'a> { + window: &'a glutin::Window, renderer: QuadRenderer, glyph_cache: GlyphCache, render_timer: bool, @@ -300,20 +299,20 @@ struct Display { pty: Pty, } -impl Display { +impl<'a> Display<'a> { pub fn update_config(&mut self, config: &Config) { self.renderer.update_config(config); self.render_timer = config.render_timer(); } - pub fn new(window: Arc<glutin::Window>, - renderer: QuadRenderer, - glyph_cache: GlyphCache, - render_timer: bool, - rx: mpsc::Receiver<(u32, u32)>, - pty: Pty) - -> Display - { + pub fn new( + window: &glutin::Window, + renderer: QuadRenderer, + glyph_cache: GlyphCache, + render_timer: bool, + rx: mpsc::Receiver<(u32, u32)>, + pty: Pty + ) -> Display { Display { window: window, renderer: renderer, |