Skip to content

Commit

Permalink
Qt: Plug memory leak in ByteViewText.
Browse files Browse the repository at this point in the history
Each time we create a ByteViewText, which is twice when a packet is
selected, the menu items leaks.  Ensure we clear the items when done.

Change-Id: Idf0c7b82bf241120dd4c42ba85c56c0a2bf8db46
Reviewed-on: https://code.wireshark.org/review/12826
Petri-Dish: Stig Bjørlykke <[email protected]>
Tested-by: Petri Dish Buildbot <[email protected]>
Reviewed-by: Stig Bjørlykke <[email protected]>
  • Loading branch information
stigbjorlykke committed Dec 22, 2015
1 parent 3bd69da commit 2997178
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ui/qt/byte_view_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ ByteViewText::ByteViewText(QWidget *parent, tvbuff_t *tvb, proto_tree *tree, QTr
setMouseTracking(true);
}

ByteViewText::~ByteViewText()
{
ctx_menu_.clear();
}

void ByteViewText::setEncoding(packet_char_enc encoding)
{
encoding_ = encoding;
Expand Down
2 changes: 2 additions & 0 deletions ui/qt/byte_view_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ByteViewText : public QAbstractScrollArea
Q_OBJECT
public:
explicit ByteViewText(QWidget *parent = 0, tvbuff_t *tvb = NULL, proto_tree *tree = NULL, QTreeWidget *protoTree = NULL, packet_char_enc encoding = PACKET_CHAR_ENC_CHAR_ASCII);
~ByteViewText();

bool hasDataSource(const tvbuff_t *ds_tvb = NULL);
void setEncoding(packet_char_enc encoding);
void setFormat(bytes_view_type format);
Expand Down

0 comments on commit 2997178

Please sign in to comment.