mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: Don't leak DiveLogImportDialog objects
The non-modal DiveLogImportDialog was only implicitly deleted when the MainWindow was destroyed. Instead hook into the accept() and reject() functions and schedule for deletion with deleteLater(). Quite the horrible proposition, but in line with Qt's object model. Consider making the dialog modal instead. There seems to be no upside for this being modal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b80fd26e81
commit
6e24762a6c
2 changed files with 18 additions and 0 deletions
|
@ -951,6 +951,22 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
MainWindow::instance()->refreshDisplay();
|
||||
}
|
||||
|
||||
// Since this is a non-modal dialog, the caller can't delete it at the call-site.
|
||||
// Therefore, hook into the accept() and reject() functions and schedule the object
|
||||
// for deletion with deleteLater(). Horrible, but absolutely the "Qt-way".
|
||||
// TODO: Think about making the dialog modal.
|
||||
void DiveLogImportDialog::accept()
|
||||
{
|
||||
QDialog::accept();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void DiveLogImportDialog::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
TagDragDelegate::TagDragDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ slots:
|
|||
void loadFileContents(int value, enum whatChanged triggeredBy);
|
||||
int setup_csv_params(QStringList r, char **params, int pnr);
|
||||
int parseTxtHeader(QString fileName, char **params, int pnr);
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
private:
|
||||
bool selector;
|
||||
|
|
Loading…
Add table
Reference in a new issue