diff --git a/DumpDVD/Gui/DumpDVD.cpp b/DumpDVD/Gui/DumpDVD.cpp index d5f4e99..737d7f3 100644 --- a/DumpDVD/Gui/DumpDVD.cpp +++ b/DumpDVD/Gui/DumpDVD.cpp @@ -50,6 +50,7 @@ namespace Li::Gui { DumpDVD::~DumpDVD() { this->keepPolling = false; this->pollDrives->join(); + delete this->lock; delete this->pollDrives; freeOldDriveList(); } @@ -101,17 +102,19 @@ namespace Li::Gui { void DumpDVD::pollDrivesThread() { while (this->keepPolling) { if ( (this->counter % (60 * 10)) == 0) { - this->lock->lock(); this->refreshDriveList(); - this->lock->unlock(); } } } void DumpDVD::refreshDriveList() { std::vector* pollDrives = Li::Scsi::OpticalDrive::ListOpticalDrives(); - freeOldDriveList(); + if(this->lock != nullptr) + this->lock->lock(); + this->freeOldDriveList(); this->drivesList = pollDrives; + if (this->lock != nullptr) + this->lock->unlock(); } void DumpDVD::freeOldDriveList() { @@ -156,10 +159,8 @@ namespace Li::Gui { } void DumpDVD::startRip() { - refreshDriveList(); if (this->GetCurrentSelectedDrive()->DiscInDrive()) { this->keepPolling = false; - this->pollDrives->join(); delete this->pollDrives;