-RM-386-MR-Race condition in WMFiberDisplay
Quickly changing input fibers of WMFiberDisplay leads to an exception in the following line:
753: ( *m_bitfieldAttribs )[ fidx ] = overrideROIFiltering | m_fiberSelector->getBitfield()->at( fidx );
Debugging reveals this is due to a race condition. The pointers m_fibers and m_fiberSelector get updated non-atomically in lines 364 and 382 respectively. The aforementioned code however runs in the OSG thread, so if it gets executed in between the updates of the two pointers, fidx ends up with too high values when accessing the bitfield in line 753.
I tried fixing this by locking a mutex for the durations of the updates and uses of the pointers, however this lead to another crash. There must be some additional dependencies between the data.
I can provide a module that outputs rapidly changing fiber data if needed for debuggung.
(from redmine: created on 2014-12-04)