Properly paint for restarted client, do not recreate painters on crash

This commit is contained in:
timvisee
2018-12-28 22:43:13 +01:00
parent 4f5a0b9274
commit b8fd77ebad
2 changed files with 20 additions and 11 deletions

View File

@@ -69,9 +69,13 @@ impl Canvas {
// Create the painter thread
let thread = thread::spawn(move || {
// Create the painter
let mut painter = Painter::new(None, area, offset, None);
loop {
// The painting loop
'paint: loop {
// Create a new client
// Connect
let client = match Client::connect(host.clone()) {
Ok(client) => client,
Err(e) => {
@@ -79,9 +83,7 @@ impl Canvas {
break 'paint;
},
};
// Create a painter
let mut painter = Painter::new(client, area, offset, None);
painter.set_client(Some(client));
// Keep painting
loop {