PDA

View Full Version : Qt + OpenCV : Ghost process when using cvCreateVideoWriter in a QThread



BinbinDesbois
25th July 2011, 13:45
I have a strange behavior.
My program saves video using openCV. On the developpment PC ( WinXP ), the programs runs correctly, moving my videoWriter to a QThread helps a lot in performance gain.
When I run it on a laptop, still on WinXP ( same SP ), I get a ghost process in the Windows task manager after exiting the program.
After tons of tests, I've isolated the faulty line :

mVideoWriter = cvCreateVideoWriter(filename.toUtf8(), CV_FOURCC('X','V','I','D'), mFps, size);
Commenting it removes the ghost process when the program exits.
The really strange behavior is that this line is only called when I hit the "Record" button. So I can have the ghost process even if the line isn't reached by the program.
It seems that there is a kind of static object created by the compiler that is not released when using a QThread but it's been days I'm searching for it.

Any help would be helpfull !

high_flyer
26th July 2011, 11:25
The really strange behavior is that this line is only called when I hit the "Record" button.
I take it that this is the way you meant the code to run, did you check to make sure?
Put a break point on the line, run the application, and see if the break point does not get caught.
Or put a message box there, if you want to try it without a debugger.
Also, search the code for other instances of cvCreateVideoWriter(), or you still might be wrong by thinking this is the problem.
Did you check (and how?) to make sure your worker thread actually does terminate?