aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/packet_dialog.cpp4
-rw-r--r--ui/qt/proto_tree.cpp16
-rw-r--r--ui/qt/proto_tree.h3
3 files changed, 17 insertions, 6 deletions
diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp
index 3d6a4fc375..e35ec88885 100644
--- a/ui/qt/packet_dialog.cpp
+++ b/ui/qt/packet_dialog.cpp
@@ -69,7 +69,9 @@ PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, frame_data *fdata)
fdata, &(cap_file_.capFile()->cinfo));
epan_dissect_fill_in_columns(&edt_, TRUE, TRUE);
- proto_tree_ = new ProtoTree(ui->packetSplitter);
+ proto_tree_ = new ProtoTree(ui->packetSplitter, &edt_);
+ // Do not call proto_tree_->setCaptureFile, ProtoTree only needs the
+ // dissection context.
proto_tree_->setRootNode(edt_.tree);
byte_view_tab_ = new ByteViewTab(ui->packetSplitter, &edt_);
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index 5d5f7509ac..26ffa2d38a 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -33,12 +33,13 @@
// To do:
// - Fix "apply as filter" behavior.
-ProtoTree::ProtoTree(QWidget *parent) :
+ProtoTree::ProtoTree(QWidget *parent, epan_dissect_t *edt_fixed) :
QTreeView(parent),
proto_tree_model_(new ProtoTreeModel(this)),
decode_as_(NULL),
column_resize_timer_(0),
- cap_file_(NULL)
+ cap_file_(NULL),
+ edt_(edt_fixed)
{
setAccessibleName(tr("Packet details"));
// Leave the uniformRowHeights property as-is (false) since items might
@@ -518,12 +519,16 @@ const QString ProtoTree::toString(const QModelIndex &start_idx) const
void ProtoTree::setCaptureFile(capture_file *cf)
{
+ // For use by the main view, set the capture file which will later have a
+ // dissection (EDT) ready.
+ // The packet dialog sets a fixed EDT context and MUST NOT use this.
+ Q_ASSERT(edt_ == NULL);
cap_file_ = cf;
}
bool ProtoTree::eventFilter(QObject * obj, QEvent * event)
{
- if ( cap_file_ && event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseMove )
+ if ( event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseMove )
return QTreeView::eventFilter(obj, event);
/* Mouse was over scrollbar, ignoring */
@@ -554,7 +559,10 @@ bool ProtoTree::eventFilter(QObject * obj, QEvent * event)
emit fieldSelected(&finfo);
selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
- QString filter = QString(proto_construct_match_selected_string(finfo.fieldInfo(), cap_file_->edt));
+ epan_dissect_t *edt = cap_file_ ? cap_file_->edt : edt_;
+ char *field_filter = proto_construct_match_selected_string(finfo.fieldInfo(), edt);
+ QString filter(field_filter);
+ wmem_free(NULL, field_filter);
if ( filter.length() > 0 )
{
diff --git a/ui/qt/proto_tree.h b/ui/qt/proto_tree.h
index 9dada379eb..6ed2e6ebb5 100644
--- a/ui/qt/proto_tree.h
+++ b/ui/qt/proto_tree.h
@@ -29,7 +29,7 @@ class ProtoTree : public QTreeView
{
Q_OBJECT
public:
- explicit ProtoTree(QWidget *parent = 0);
+ explicit ProtoTree(QWidget *parent = 0, epan_dissect_t *edt_fixed = 0);
QMenu *colorizeMenu() { return &colorize_menu_; }
void setRootNode(proto_node *root_node);
void emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type = FT_FRAMENUM_NONE);
@@ -62,6 +62,7 @@ private:
QPoint drag_start_position_;
capture_file *cap_file_;
+ epan_dissect_t *edt_;
void saveSelectedField(QModelIndex &index);
static void foreachTreeNode(proto_node *node, gpointer proto_tree_ptr);