Fix crash
This commit is contained in:
parent
98b5577a9a
commit
079cb1129e
|
@ -50,6 +50,7 @@ namespace Li::Gui {
|
||||||
DumpDVD::~DumpDVD() {
|
DumpDVD::~DumpDVD() {
|
||||||
this->keepPolling = false;
|
this->keepPolling = false;
|
||||||
this->pollDrives->join();
|
this->pollDrives->join();
|
||||||
|
delete this->lock;
|
||||||
delete this->pollDrives;
|
delete this->pollDrives;
|
||||||
freeOldDriveList();
|
freeOldDriveList();
|
||||||
}
|
}
|
||||||
|
@ -101,17 +102,19 @@ namespace Li::Gui {
|
||||||
void DumpDVD::pollDrivesThread() {
|
void DumpDVD::pollDrivesThread() {
|
||||||
while (this->keepPolling) {
|
while (this->keepPolling) {
|
||||||
if ( (this->counter % (60 * 10)) == 0) {
|
if ( (this->counter % (60 * 10)) == 0) {
|
||||||
this->lock->lock();
|
|
||||||
this->refreshDriveList();
|
this->refreshDriveList();
|
||||||
this->lock->unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpDVD::refreshDriveList() {
|
void DumpDVD::refreshDriveList() {
|
||||||
std::vector<Li::Scsi::OpticalDrive*>* pollDrives = Li::Scsi::OpticalDrive::ListOpticalDrives();
|
std::vector<Li::Scsi::OpticalDrive*>* pollDrives = Li::Scsi::OpticalDrive::ListOpticalDrives();
|
||||||
freeOldDriveList();
|
if(this->lock != nullptr)
|
||||||
|
this->lock->lock();
|
||||||
|
this->freeOldDriveList();
|
||||||
this->drivesList = pollDrives;
|
this->drivesList = pollDrives;
|
||||||
|
if (this->lock != nullptr)
|
||||||
|
this->lock->unlock();
|
||||||
|
|
||||||
}
|
}
|
||||||
void DumpDVD::freeOldDriveList() {
|
void DumpDVD::freeOldDriveList() {
|
||||||
|
@ -156,10 +159,8 @@ namespace Li::Gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpDVD::startRip() {
|
void DumpDVD::startRip() {
|
||||||
refreshDriveList();
|
|
||||||
if (this->GetCurrentSelectedDrive()->DiscInDrive()) {
|
if (this->GetCurrentSelectedDrive()->DiscInDrive()) {
|
||||||
this->keepPolling = false;
|
this->keepPolling = false;
|
||||||
|
|
||||||
this->pollDrives->join();
|
this->pollDrives->join();
|
||||||
delete this->pollDrives;
|
delete this->pollDrives;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue