Callbacks get called before view data is initialized on the first main loop iteration

Open
#157 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start at show() and init(), then trace the first main loop iteration and callback registration path. Reproduce a callback that reads camera parameters immediately after show(); done means view data is initialized before the callback runs and no NaNs appear on that first iteration.

Written by the indexing model from the issue text.

Description

bug

If you create a callback function, register it, and then show() in the usual fashion, on the first main loop iteration the callback will be invoked before the view data is initialized. If the callback accesses e.g. the camera parameters, it will get NaNs on the first iteration, which can be a confusing source of errors (even if transient).

We should make sure everything is initialized right away at the beginning of show(), before anything else happens. More deeply, maybe we should reconsider why we initialize view parameters lazily in show() rather than init().

Dominant language
C++
Stars
2.2k
Forks
242
Avg merge
11m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nmwsharp/polyscope

All issues in nmwsharp/polyscope

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.