Prevent closing of the RipCDDialog if the ripper is running

This prevents a segfault when a running dialog is closed and later reopened.
This commit is contained in:
Mattias Andersson 2018-07-07 10:26:11 +02:00 committed by John Maguire
parent 10d4c502fd
commit e9a4db0192
2 changed files with 12 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include "ripper/ripcddialog.h"
#include <QCheckBox>
#include <QCloseEvent>
#include <QFileDialog>
#include <QFileInfo>
#include <QLineEdit>
@ -45,7 +46,7 @@ const int kCheckboxColumn = 0;
const int kTrackNumberColumn = 1;
const int kTrackTitleColumn = 2;
const int kTrackDurationColumn = 3;
}
} // namespace
const char* RipCDDialog::kSettingsGroup = "Transcoder";
const int RipCDDialog::kMaxDestinationItems = 10;
@ -132,6 +133,12 @@ RipCDDialog::~RipCDDialog() {}
bool RipCDDialog::CheckCDIOIsValid() { return ripper_->CheckCDIOIsValid(); }
void RipCDDialog::closeEvent(QCloseEvent* event) {
if (working_) {
event->ignore();
}
}
void RipCDDialog::showEvent(QShowEvent* event) {
ResetDialog();
loader_->LoadSongs();

View File

@ -19,6 +19,7 @@
#define SRC_RIPPER_RIPCDDIALOG_H_
#include <memory>
#include <QDialog>
#include <QFile>
@ -26,7 +27,9 @@
#include "core/tagreaderclient.h"
class QCheckBox;
class QCloseEvent;
class QLineEdit;
class QShowEvent;
class CddaSongLoader;
class Ripper;
@ -41,6 +44,7 @@ class RipCDDialog : public QDialog {
bool CheckCDIOIsValid();
protected:
void closeEvent(QCloseEvent* event);
void showEvent(QShowEvent* event);
private slots: