Skip to content

spd: Make sure sayAll progress callback gets the correct offsets

Colomban Wendling requested to merge cwendling/orca:progress-race into master

As the context object holds the offsets and they are updated between each callback call, and the callback gets a reference to the context itself, if more than one callback gets scheduled at the same time their context object would be identical: the object for the first callback would be updated for the second one already.

To fix that, pass a copy of the context object to the callbacks so it is not updated erroneously.

As the speech-dispatcher and GLib loops are entirely separate, there is no synchronization and speech-dispatcher sometimes schedules 2 (I didn't see more, but that could happen if GLib got "stuck" a bit) GLib idle callbacks before they are dispatched, so without a fix we miss some offsets, and we have duplicate ones instead.

Merge request reports