1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-18 20:40:43 +01:00

Lock access to WMDM devices

This commit is contained in:
David Sansome 2010-09-04 11:18:59 +00:00
parent 034555942b
commit c9e5a3dce7

View File

@ -55,11 +55,15 @@ void WmdmDevice::Init() {
connect(loader_, SIGNAL(LoadFinished()), SLOT(LoadFinished())); connect(loader_, SIGNAL(LoadFinished()), SLOT(LoadFinished()));
connect(loader_thread_, SIGNAL(started()), loader_, SLOT(LoadDatabase())); connect(loader_thread_, SIGNAL(started()), loader_, SLOT(LoadDatabase()));
loader_thread_->start(); loader_thread_->start();
db_busy_.lock();
} }
void WmdmDevice::LoadFinished() { void WmdmDevice::LoadFinished() {
loader_->deleteLater(); loader_->deleteLater();
loader_ = NULL; loader_ = NULL;
db_busy_.unlock();
} }
bool WmdmDevice::StartCopy(QList<Song::FileType>* supported_types) { bool WmdmDevice::StartCopy(QList<Song::FileType>* supported_types) {
@ -263,6 +267,8 @@ bool WmdmDevice::GetSupportedFiletypes(QList<Song::FileType>* ret, IWMDMDevice*
} }
bool WmdmDevice::GetSupportedFiletypes(QList<Song::FileType>* ret) { bool WmdmDevice::GetSupportedFiletypes(QList<Song::FileType>* ret) {
QMutexLocker l(&db_busy_);
WmdmThread thread; WmdmThread thread;
// Get the device // Get the device