Skip to content

Commit

Permalink
Fix canvas extraction in open_cb and add guards (#131)
Browse files Browse the repository at this point in the history
Fixes #129
  • Loading branch information
timholy authored Jan 22, 2020
1 parent 3b4fdcd commit c39dfbb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ProfileView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c39dfbb

Please sign in to comment.