openframeworks / openframeworks/openFrameworks
programmable renderer crashes if currently bound shader is deleted
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
This is probably an edge case, but I'm finding that if a shader is bound (begin) and then deleted without unbinding (end) in ofApp::draw() while using the programmable renderer, there is a crash on anything that uses the internal currentShader pointer.
I'm running into this while using ofxLua where the script side of the app creates the shader and binds it. A script error then occurs before the shader is unbound and the script state is cleared (including the shader). Perhaps the shader should be unbound before it is cleared as a precaution?
EDIT: This is using the current OF stable release on macOS 10.12.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ofApp::draw() and trace the programmable renderer's currentShader handling when a bound shader is deleted, using the ofxLua failure scenario as a reproduction guide. Verify that deleting a currently bound shader no longer crashes later uses of currentShader and that the shader lifecycle remains safe after script state is cleared.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100