Do not connect null to a signal

The parent here should have been the mainwindow, but we create this dialog
on the stack instead of the heap and because of that we don't set the
parent to prevent a double free.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-05-25 16:01:57 -03:00 committed by Dirk Hohndel
parent f17f4ec9a0
commit adb61b38ea

View file

@ -24,7 +24,7 @@ DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
ui->setupUi(this); ui->setupUi(this);
showExplanation(); showExplanation();
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), MainWindow::instance(), SLOT(close()));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));