Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: 2 consequent [QTMovieView setMovie:] calls => crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 consequent [QTMovieView setMovie:] calls => crash



Tim,

thank you very much for your reply. I tried what you proposed:

In my project, I have a QTMovieView, and m_movieView is an outlet
pointing to it. When I run the following code, my application crashes:


NSError* err = nil;
QTMovie* my_movie = [QTMovie movieWithFile: kPathToMyMovie error:
&err];
[m_movieView setMovie: my_movie];
[m_movieView display];
[m_movieView setMovie: nil];
[m_movieView display];

My question is: what am I doing wrong? Why does my app crash here?
How can I avoid such crashes?


By default, a QTMovie is loaded asynchronously. That is,
movieWithFile:error: will return very quickly, even if the movie is
not fully loaded. This might be what's causing problems here. Try
maybe loading the movie synchronously:

NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
kPathToMyMovie, QTMovieFileNameAttribute,
[NSNumber numberWithBool:NO],
QTMovieOpenAsyncOKAttribute, nil];
QTMovie *myMovie = [QTMovie movieWithAttributes:attributes error:&err];


Does that help? Even if it does help, you should file a bug report.

This didn't help. My code still crashes, and it still happens inside [NSOpenGLContext dealloc].


However, I've already found a workaround for my real application. Three ways out of the problem have been proposed on this list by Nicolas Zinovieff, and what I made in my code is variant number 4, which actually reduces to being smart and avoid calling setMovie twice, second time right after the first one. This fixes the crash, and besides, I believe that this is the right approach just because even if consequent calls to setMovie did work, they would not be optimal and might have lead to screen flicker.

Nevertheless, I'm still curious about the root of the original problem. If you don't mind, I can send my test project to you so that you can try it on your computer. It's really small, not much more than the code snippet posted to the list actually.

I have submitted a bug report to radar:
rdar://5352052

Best regards,
Sergey Shapovalov.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.