EngineController: always call Phonon::availableMimeTypes() from main thread
authorMatěj Laitl <matej@laitl.cz>
Mon, 25 Jun 2012 18:33:52 +0000 (20:33 +0200)
committerMatěj Laitl <matej@laitl.cz>
Thu, 19 Jul 2012 13:24:51 +0000 (15:24 +0200)
commitf0d64b33bdd6f58d807184a06affaad1c54b8b28
treef60eba00edf605615ef46f4be8cb05b93ebc14c4
parente5cafbbae804a1c84d6b2245e7992dc0183a6477
EngineController: always call Phonon::availableMimeTypes() from main thread

If supportedMimeTypes() is called for the first time in a thread,
Phonon::BackendCapabilities::availableMimeTypes() creates some QObject
subclasses in non-main thread and that causes problems when they are
deleted. Add signal/slot/QSemaphore trickery that causes
Phonon::BackendCapabilities::availableMimeTypes() is called from the
main thread without performance penalty for 2nd and next calls.

Test is added for it (EngineController::supportedMimeTypes()) so that
this fragile code (hopefully) never breaks again.
src/EngineController.cpp
src/EngineController.h
tests/CMakeLists.txt
tests/TestEngineController.cpp [new file with mode: 0644]
tests/TestEngineController.h [new file with mode: 0644]