qt: networkmediamodel: execute media_tree callback in Qt thread
commit86f76284521c4fce03c18b53b00853bd5519a873
authorAlexandre Janniaux <ajanni@videolabs.io>
Fri, 17 Jan 2020 14:30:55 +0000 (17 15:30 +0100)
committerThomas Guillem <thomas@gllm.fr>
Wed, 22 Jan 2020 09:08:28 +0000 (22 10:08 +0100)
treee8c55f9519505cc00196efc5736e7f7cc00888d4
parent6f998111ffd5d8d0ad7e20d68a402914ce44cd41
qt: networkmediamodel: execute media_tree callback in Qt thread

Delegate media_tree callback handling to the Qt thread, so that
NetworkMediaModel's internal is locked and race-free.

It needs Qt::QueuedConnection because those callbacks are either called
from the service discovery thread (normal runtime behaviour) or from the
Qt thread itself when it adds the listener (initialization). Without
Qt::QueuedConnection, the lambda won't be queued in the later case as it
is run in the same thread, and will be executed in place, which in turn
leads to a double lock.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
modules/gui/qt/network/networkmediamodel.cpp