Re: wineqtdecoder: properly clean up splitter and loader threads on QTSplitter destruction
Aric Stewart <aric(a)codeweavers.com> writes:
@@ -495,9 +518,14 @@ static DWORD WINAPI QTSplitter_loading_thread(LPVOID data) to try to minimize that. */
- while(GetMovieLoadState(This->pQTMovie) < kMovieLoadStateComplete) + while(This->pQTMovie && GetMovieLoadState(This->pQTMovie) < kMovieLoadStateComplete) { EnterCriticalSection(&This->csReceive); + if (!This || !This->pQTMovie) + { + LeaveCriticalSection(&This->csReceive); + return 0; + }
This doesn't make sense. The this pointer cannot become NULL, and the whole thing should most likely be inside the critical section. -- Alexandre Julliard julliard(a)winehq.org
On 12/11/20 5:29, Alexandre Julliard wrote:
Aric Stewart <aric(a)codeweavers.com> writes:
@@ -495,9 +518,14 @@ static DWORD WINAPI QTSplitter_loading_thread(LPVOID data) to try to minimize that. */
- while(GetMovieLoadState(This->pQTMovie) < kMovieLoadStateComplete) + while(This->pQTMovie && GetMovieLoadState(This->pQTMovie) < kMovieLoadStateComplete) { EnterCriticalSection(&This->csReceive); + if (!This || !This->pQTMovie) + { + LeaveCriticalSection(&This->csReceive); + return 0; + }
This doesn't make sense. The this pointer cannot become NULL, and the whole thing should most likely be inside the critical section.
I added the check on the "this" pointer just to cover my bases. I agree that there is no way I was seeing that it would become NULL. I can easily remove that. I cannot add the whole while loop into the critical section because then the loading thread block playing, which defeats the point. Unless I can do. EnterCriticalSection(&This->csReceive); while(This->pQTMovie && GetMovieLoadState(This->pQTMovie) < kMovieLoadStateComplete) { . . . LeaveCriticalSection(&This->csReceive); Sleep(0); EnterCriticalSection(&This->csReceive); } LeaveCriticalSection(&This->csReceive); Does that work? -aric
participants (2)
-
Alexandre Julliard -
Aric Stewart