[vlc-devel] [PATCH] 64-bit support for mozilla plugin on Mac OS X

David Menestrina dmenest-vlc at ofb.net
Tue May 11 01:31:05 CEST 2010


On Mon, May 10, 2010 at 4:02 PM, Pierre d'Herbemont
<pdherbemont at gmail.com> wrote:
>>  1) Cocoa documentation says that NSView is not threadsafe, yet this
>>     code uses NSView in the vout thread for entering fullscreen mode.
>
> It's easy to dispatch a selector on main thread using -performSelectorOnMainThread:withObject:,
> why don't you use it?

I did have a version that used that method, but it didn't seem to
solve my issues, and it made the code more complicated.  It is
probably the right thing to do, but I'd like to understand better
which things need to be done in the main thread.  For example, if I
alloc/init an object in the main thread, must I also release it in the
main thread? Or can that be done from a secondary thread?  (I noticed
that with waitUntilDone=YES, releasing in the main thread seemed to
hang when done from dealloc in a secondary thread.)

Also, is it OK to invoke something on the main thread with
waitUntilDone=YES within the Display function of a vout display?

>>  3) I have read that Cocoa requires an NSAutoreleasePool to exist for
>>     any thread that makes Cocoa calls.  The vout thread does not have one,
>>     and therefore the plugin will leak memory.
> It's easy to create one when one is needed. Just wrap your Code like this:
>
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> // Code
> [pool drain];

Is this something that's efficient to do every time I make a Cocoa
call?  The examples I've seen generally create one at the beginning of
the thread entry point so that all objects created within the thread
use the same pool.

Thanks,
david



More information about the vlc-devel mailing list