From 4b5a0dc0c0219e49747e1120aeca8ecb8dfcfaa8 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Thu, 30 Apr 2020 14:42:18 +0200 Subject: [PATCH] Fix crashes on IDE startup (https://github.com/enso-org/ide/pull/393) Original commit: https://github.com/enso-org/ide/commit/e4904224c5c6870148473691b402123c7704fc5d --- .../rust/ensogl/src/display/shape/text/glyph/system.rs | 2 +- gui/src/rust/ide/src/view/node_editor.rs | 8 ++++++-- gui/src/rust/lib/logger/src/lib.rs | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gui/src/rust/ensogl/src/display/shape/text/glyph/system.rs b/gui/src/rust/ensogl/src/display/shape/text/glyph/system.rs index c5e41e995e..293efac23c 100644 --- a/gui/src/rust/ensogl/src/display/shape/text/glyph/system.rs +++ b/gui/src/rust/ensogl/src/display/shape/text/glyph/system.rs @@ -267,4 +267,4 @@ impl GlyphSystem { } const BEFORE_MAIN : &str = include_str!("glyph.glsl"); -const MAIN : &str = "output_color = color_from_msdf(); output_id=uvec4(0,0,0,0);"; +const MAIN : &str = "output_color = color_from_msdf(); output_id=vec4(0.0,0.0,0.0,0.0);"; diff --git a/gui/src/rust/ide/src/view/node_editor.rs b/gui/src/rust/ide/src/view/node_editor.rs index 6eadf57d54..ed1b88963d 100644 --- a/gui/src/rust/ide/src/view/node_editor.rs +++ b/gui/src/rust/ide/src/view/node_editor.rs @@ -74,9 +74,13 @@ impl GraphEditorIntegration { let stream = this.controller.subscribe(); let weak = Rc::downgrade(this); let handler = process_stream_with_handle(stream,weak,move |notification,this| { - match notification { - notification::Graph::Invalidate => this.invalidate_graph().unwrap(), // FIXME unwrap + let result = match notification { + notification::Graph::Invalidate => this.invalidate_graph(), }; + if let Err(err) = result { + error!(this.logger,"Error while updating graph after receiving {notification:?} \ + from controller: {err}"); + } futures::future::ready(()) }); executor::global::spawn(handler); diff --git a/gui/src/rust/lib/logger/src/lib.rs b/gui/src/rust/lib/logger/src/lib.rs index df25ddfa30..acacecdbc8 100644 --- a/gui/src/rust/lib/logger/src/lib.rs +++ b/gui/src/rust/lib/logger/src/lib.rs @@ -208,6 +208,13 @@ macro_rules! warning { }; } +#[macro_export] +macro_rules! error { + ($($toks:tt)*) => { + $crate::log_template! {error $($toks)*} + }; +} + #[macro_export] macro_rules! internal_warning { ($($toks:tt)*) => {