[vlc-devel] [PATCH 1/3] Qt: Run mainloop on the main thread on OSX

Juho Vähä-Herttua juhovh at iki.fi
Sat Jul 31 21:11:11 CEST 2010

On 31.7.2010, at 21.23, Rémi Denis-Courmont wrote:
> Le samedi 31 juillet 2010 21:12:38 Juho Vähä-Herttua, vous avez écrit :
>> On other platforms the semaphore is used to synchronize functions "Open"
>> and "Thread", which run in different threads. On OSX I attempted to use
>> the semaphore to synchronize functions "Close" and "Thread", from which I
>> have no guarantee that they are run from the same thread.
> You do have that guarantee. A thread cannot call module_unneed() (which calls 
> pf_deactivate = Close) before a succesful *completed* call to module_need 
> (which calls pf_activate = Open). Hence Close() cannot be called before 
> Open().

Thank you, this conversation cleared up a lot, and I made a patch that I hope is something you're after. There's only two issues I can think of:

1) the variable creation is moved to RegisterIntf function, because it needs to be called from two different places, avoids code duplication
2) the semaphore is still created and used even on Mac OS X single thread, I don't think this is an issue since it's a no-op here as you said

Everything seemed to work fine when I tested, unless libvlc_Quit is called during video playback as already mentioned before. That will give the good old main interface destroyed before vout_window_Delete called issue:

Assertion failed: (!stable), function ~VideoWidget, file ../../../../modules/gui/qt4/components/interface_widgets.cpp, line 81.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Qt-Run-mainloop-on-the-main-thread-on-OSX.patch
Type: application/octet-stream
Size: 3011 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100731/f3bc7cef/attachment.obj>
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4215 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100731/f3bc7cef/attachment.bin>

More information about the vlc-devel mailing list