openframeworks / openframeworks/openFrameworks
ofVideoGrabber and ofThread crash on exit (osx)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
Having an ofThread and ofVideoGrabber, and trying to close the thread nicely waiting for its work getting done when exiting, makes the videograbber to crash on exit with a EXC_BAD_ACCESS in libsystem_kernel.dylib. I can see the crash is related to [QTKitVideoGrabber stop]
#include "ofApp.h"
void ofApp::setup(){
startThread();
grabber.setup(600,400);
}
void ofApp::update(){
grabber.update();
}
void ofApp::draw(){
grabber.draw(0,0);
}
void ofApp::exit(){
if(isThreadRunning()){
waitForThread();
}
}
void ofApp::threadedFunction(){
while(isThreadRunning()) {
sleep(5);
}
}
If i leave out sleep(5), then there is no problem.
Running on OSX 10.11.2
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
Reproduce the provided ofThread and ofVideoGrabber example on OSX 10.11.2, focusing on the exit path and the QTKitVideoGrabber stop call. Compare behavior with and without sleep(5), then trace the thread shutdown and video-grabber cleanup. Done means the example exits without the EXC_BAD_ACCESS crash while waiting for the thread to finish.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100