Skip to content

Commit

Permalink
make sure we wait for the screen session (#4316)
Browse files Browse the repository at this point in the history
* make sure we wait for the screen session

* add changelog

* fix bug
  • Loading branch information
SimonDanisch authored Sep 4, 2024
1 parent 19962ba commit 8617742
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Make sure we wait for the screen session [#4316](https://github.com/MakieOrg/Makie.jl/pull/4316).
- Fix for absrect [#4312](https://github.com/MakieOrg/Makie.jl/pull/4312).
- Fix attribute updates for SpecApi and SpecPlots (e.g. ecdfplot) [#4265](https://github.com/MakieOrg/Makie.jl/pull/4265).
- Bring back `poly` convert arguments for matrix with points as row [#4266](https://github.com/MakieOrg/Makie.jl/pull/4258).
Expand Down
8 changes: 5 additions & 3 deletions WGLMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ function get_screen_session(screen::Screen; timeout=100,
throw_error("Screen has no session. Not yet displayed?")
return nothing
end
if !(screen.session.status in (Bonito.RENDERED, Bonito.DISPLAYED, Bonito.OPEN))
session = screen.session
if !(session.status in (Bonito.RENDERED, Bonito.DISPLAYED, Bonito.OPEN))
throw_error("Screen Session uninitialized. Not yet displayed? Session status: $(screen.session.status)")
return nothing
end
success = Bonito.wait_for_ready(screen.session; timeout=timeout)
success = Bonito.wait_for_ready(session; timeout=timeout)
if success !== :success
throw_error("Timed out waiting for session to get ready")
return nothing
Expand All @@ -224,7 +225,7 @@ function get_screen_session(screen::Screen; timeout=100,
throw_error("Timed out waiting $(timeout)s for session to get initilize")
end
# At this point we should have a fully initialized plot + session
return screen.session
return session
end

function Makie.apply_screen_config!(screen::Screen, config::ScreenConfig, args...)
Expand Down Expand Up @@ -258,6 +259,7 @@ function Base.display(screen::Screen, scene::Scene; unused...)
return render_with_init(screen, session, scene)
end
display(app)
Bonito.wait_for(()-> !isnothing(screen.session))
Bonito.wait_for_ready(screen.session)
# wait for plot to be full initialized, so that operations don't get racy (e.g. record/RamStepper & friends)
get_screen_session(screen; error="Waiting for plot to be initialized in display")
Expand Down

0 comments on commit 8617742

Please sign in to comment.