[vlc-devel] [vlc-commits] macosx: fix conditional crash when setting the MRL field
Felix Paul Kühne
fkuehne.videolan at gmail.com
Wed Jul 3 22:46:58 CEST 2013
On 03.07.2013, at 15:58, David Fuhrmann <david.fuhrmann at gmail.com> wrote:
> I am wondering what's the code path for this crash? And why is it ok to call setEnabled on a non-main thread but need to call setStringValue on the main thread?
This is because of AppKit, which isn't thread-safe by definition, so everything UI must run and be set on the main thread. However, based upon on subjective observation over the last couple of years, basically setters like setEnabled, setHidden, and friends _are_ thread safe. However, set*Value isn't for any control.
Since this method can run on non-main threads according to VLC 2.0.7 crash logs, this patch prevents rare crashes (like 2 in 5000).
> Perhaps it would make sense to add a small comment, if this is really the only possible fix. Otherwise we might ask later why we have this performSelectorOnMain here.
Yep, I'll add something.
More information about the vlc-devel