Qt: fix crash when double clicking on a row in 'Decode As' dialog
No need to register for the destroyed() signal: it is emitted after the new QComboBox object is created and resetting pointers to NULL is useless as they are locals initialized in the constructor Bug: 11532 Change-Id: Ie707cafa370053df846a4732aed20c182e030c40 Reviewed-on: https://code.wireshark.org/review/10792 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
a459ac72a2
commit
3f56b5e6b9
|
@ -74,7 +74,8 @@ DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_ne
|
||||||
ui(new Ui::DecodeAsDialog),
|
ui(new Ui::DecodeAsDialog),
|
||||||
cap_file_(cf),
|
cap_file_(cf),
|
||||||
table_names_combo_box_(NULL),
|
table_names_combo_box_(NULL),
|
||||||
selector_combo_box_(NULL)
|
selector_combo_box_(NULL),
|
||||||
|
cur_proto_combo_box_(NULL)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle(wsApp->windowTitleString(tr("Decode As" UTF8_HORIZONTAL_ELLIPSIS)));
|
setWindowTitle(wsApp->windowTitleString(tr("Decode As" UTF8_HORIZONTAL_ELLIPSIS)));
|
||||||
|
@ -268,7 +269,6 @@ void DecodeAsDialog::on_decodeAsTreeWidget_itemActivated(QTreeWidgetItem *item,
|
||||||
selector_combo_box_->setEditable(true);
|
selector_combo_box_->setEditable(true);
|
||||||
selector_combo_box_->lineEdit()->setText(item->text(selector_col_));
|
selector_combo_box_->lineEdit()->setText(item->text(selector_col_));
|
||||||
|
|
||||||
connect(selector_combo_box_, SIGNAL(destroyed()), this, SLOT(selectorDestroyed()));
|
|
||||||
connect(selector_combo_box_, SIGNAL(editTextChanged(QString)), this, SLOT(selectorEditTextChanged(QString)));
|
connect(selector_combo_box_, SIGNAL(editTextChanged(QString)), this, SLOT(selectorEditTextChanged(QString)));
|
||||||
|
|
||||||
ui->decodeAsTreeWidget->setItemWidget(item, selector_col_, selector_combo_box_);
|
ui->decodeAsTreeWidget->setItemWidget(item, selector_col_, selector_combo_box_);
|
||||||
|
@ -278,14 +278,12 @@ void DecodeAsDialog::on_decodeAsTreeWidget_itemActivated(QTreeWidgetItem *item,
|
||||||
ui->decodeAsTreeWidget->setItemWidget(item, proto_col_, cur_proto_combo_box_);
|
ui->decodeAsTreeWidget->setItemWidget(item, proto_col_, cur_proto_combo_box_);
|
||||||
connect(cur_proto_combo_box_, SIGNAL(currentIndexChanged(const QString &)),
|
connect(cur_proto_combo_box_, SIGNAL(currentIndexChanged(const QString &)),
|
||||||
this, SLOT(curProtoCurrentIndexChanged(const QString &)));
|
this, SLOT(curProtoCurrentIndexChanged(const QString &)));
|
||||||
connect(cur_proto_combo_box_, SIGNAL(destroyed()), this, SLOT(curProtoDestroyed()));
|
|
||||||
|
|
||||||
table_names_combo_box_->setCurrentIndex(table_names_combo_box_->findText(current_text));
|
table_names_combo_box_->setCurrentIndex(table_names_combo_box_->findText(current_text));
|
||||||
tableNamesCurrentIndexChanged(current_text);
|
tableNamesCurrentIndexChanged(current_text);
|
||||||
|
|
||||||
connect(table_names_combo_box_, SIGNAL(currentIndexChanged(const QString &)),
|
connect(table_names_combo_box_, SIGNAL(currentIndexChanged(const QString &)),
|
||||||
this, SLOT(tableNamesCurrentIndexChanged(const QString &)));
|
this, SLOT(tableNamesCurrentIndexChanged(const QString &)));
|
||||||
connect(table_names_combo_box_, SIGNAL(destroyed()), this, SLOT(tableNamesDestroyed()));
|
|
||||||
table_names_combo_box_->setFocus();
|
table_names_combo_box_->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,11 +404,6 @@ void DecodeAsDialog::on_copyToolButton_clicked()
|
||||||
addRecord(true);
|
addRecord(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeAsDialog::tableNamesDestroyed()
|
|
||||||
{
|
|
||||||
table_names_combo_box_ = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DecodeAsDialog::decodeAddProtocol(const gchar *, const gchar *proto_name, gpointer value, gpointer user_data)
|
void DecodeAsDialog::decodeAddProtocol(const gchar *, const gchar *proto_name, gpointer value, gpointer user_data)
|
||||||
{
|
{
|
||||||
QSet<dissector_info_t *> *dissector_info_set = (QSet<dissector_info_t *> *)user_data;
|
QSet<dissector_info_t *> *dissector_info_set = (QSet<dissector_info_t *> *)user_data;
|
||||||
|
@ -495,11 +488,6 @@ void DecodeAsDialog::tableNamesCurrentIndexChanged(const QString &text)
|
||||||
cur_proto_combo_box_->setCurrentIndex(cur_proto_combo_box_->findText(current_text));
|
cur_proto_combo_box_->setCurrentIndex(cur_proto_combo_box_->findText(current_text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeAsDialog::selectorDestroyed()
|
|
||||||
{
|
|
||||||
selector_combo_box_ = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DecodeAsDialog::selectorEditTextChanged(const QString &text)
|
void DecodeAsDialog::selectorEditTextChanged(const QString &text)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = ui->decodeAsTreeWidget->currentItem();
|
QTreeWidgetItem *item = ui->decodeAsTreeWidget->currentItem();
|
||||||
|
@ -533,11 +521,6 @@ void DecodeAsDialog::curProtoCurrentIndexChanged(const QString &text)
|
||||||
item->setData(proto_col_, Qt::UserRole, cur_proto_combo_box_->itemData(cur_proto_combo_box_->findText(text)));
|
item->setData(proto_col_, Qt::UserRole, cur_proto_combo_box_->itemData(cur_proto_combo_box_->findText(text)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeAsDialog::curProtoDestroyed()
|
|
||||||
{
|
|
||||||
cur_proto_combo_box_ = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef QPair<const char *, guint32> UintPair;
|
typedef QPair<const char *, guint32> UintPair;
|
||||||
typedef QPair<const char *, const char *> CharPtrPair;
|
typedef QPair<const char *, const char *> CharPtrPair;
|
||||||
|
|
||||||
|
|
|
@ -82,12 +82,9 @@ private slots:
|
||||||
void on_deleteToolButton_clicked();
|
void on_deleteToolButton_clicked();
|
||||||
void on_copyToolButton_clicked();
|
void on_copyToolButton_clicked();
|
||||||
|
|
||||||
void tableNamesDestroyed();
|
|
||||||
void tableNamesCurrentIndexChanged(const QString & text);
|
void tableNamesCurrentIndexChanged(const QString & text);
|
||||||
void selectorDestroyed();
|
|
||||||
void selectorEditTextChanged(const QString & text);
|
void selectorEditTextChanged(const QString & text);
|
||||||
void curProtoCurrentIndexChanged(const QString & text);
|
void curProtoCurrentIndexChanged(const QString & text);
|
||||||
void curProtoDestroyed();
|
|
||||||
void applyChanges();
|
void applyChanges();
|
||||||
void on_buttonBox_clicked(QAbstractButton *button);
|
void on_buttonBox_clicked(QAbstractButton *button);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue