qt: medialib: define a medialib thread pool
The database queries, initiated by list models, must be executed asynchronously (on a thread different from the UI thread). When a list model is destroyed (from the UI thread), some database queries might still be executing. It would be incorrect for the list model to wait for them (it would block the UI thread), so they must be executed on an external thread pool. Since the queries themselves require the medialib to be executed, they must not outlive it (or the asynchronous code might crash). Therefore, the right scope for executing asynchronous queries is the MediaLib instance.
Please register or sign in to comment