Search code examples
movieqtkitreward

QTKit creating threads that never die when I play new movies


I have an app that composes movies and then plays them via QTMovieView. Each time I [movieView setMovie:newMovie], QTKit creates a new thread that never dies. It also appears that the movie is never dealloced. I created a simple example that illustrates the problem:

http://cl.ly/371e0p443Q2K0R3f0Q1w/MovieLeak.zip

I will happily pay someone to solve this problem!


Solution

  • You have a big fat memory leak in this method:

    -(void)restartMovie {
        QTMovie *m = [movieView movie];
        [m stop];
        [movieView setMovie:[m copy]]; // <- copy creates an object THAT YOU OWN!!!
        [movieView play:self];
    }
    

    so this behavior is expected.