From 05d4415f3f080dbbea3e161296619eb25673cf73 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 22 Jan 2020 03:04:46 -0600 Subject: [PATCH] Fix canvas extraction in open_cb and add guards Fixes #129 --- src/ProfileView.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index b4791d2..d045b68 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -184,15 +184,15 @@ function viewprof(fcolor, c, g; fontsize=14) return nothing end -function open_cb(::Ptr, settings::Tuple) - C, kwargs = settings +@guarded function open_cb(::Ptr, settings::Tuple) + c, kwargs = settings selection = open_dialog("Load profile data", toplevel(c), ("*.jlprof","*")) isempty(selection) && return nothing data, lidict = load(File(format"JLD", selection), "li", "lidict") - return view(data; lidict=lidict, C=C, kwargs...) + return view(data; lidict=lidict, kwargs...) end -function save_as_cb(::Ptr, profdata::Tuple) +@guarded function save_as_cb(::Ptr, profdata::Tuple) c, data, lidict = profdata selection = save_dialog("Save profile data as JLD file", toplevel(c), ("*.jlprof",)) isempty(selection) && return nothing