[vlc-devel] [PATCH 5/6] qt4: Run mainloop on the main thread on OSX
juhovh at iki.fi
Sun Jul 25 19:07:42 CEST 2010
On 25.7.2010, at 19.06, Rémi Denis-Courmont wrote:
>> The b_run_on_first_thread hack does exactly this with
>> its MonitorLibVLCDeath thread, allowing me to execute any code after
>> libvlc_Quit() there. Without it the player just gets stuck forever in the
>> Qt4 main loop with no one telling it to quit.
> libvlc_SetExitHandler() does that in much cleaner manner.
The libvlc_SetExitHandler() indeed seems much better than the MonitorLibVLCDeath thread. I don't want to use it for all Mac interface modules though, which means I should set a flag in the Open function if it should be used or not. Basically this means b_run_on_first_thread hack again... Calling libvlc_SetExitHandler() from qt4 interface seems a bit too ugly, and I don't think any interface code should go to mess with the core internals.
What I would really want to do most is to add a function pointer to intf_thread_t that would be registered to libvlc_SetExitHandler(). It would call QVLCApp::triggerQuit() and nothing else to get the interface module out of the QApplication main loop, everything else should work fine after that. But I think we're trying to get rid of hacks instead of adding more of them. The options I see here are:
1) Call libvlc_SetExitHandler() directly from the Qt4 interface module, UGLY
2) Keep the b_run_on_first_thread hack and add another function pointer to intf_thread_t for exit handler, UGLY
3) Keep the b_run_on_first_thread hack, rewrite MonitorLibVLCDeath to use libvlc_SetExitHandler, call Close manually somehow and hack around to prevent core from calling it twice, UGLY
Number 1 would make the qt4 interface access the core internals, number 2 would require adding more hacks to intf_thread_t, number 3 is what I've done so far. (except changing the MonitorLibVLCDeath into SetExitHandler part)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4215 bytes
Desc: not available
More information about the vlc-devel