aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-09-11 11:13:23 -0700
committerGerald Combs <gerald@wireshark.org>2015-09-11 20:37:09 +0000
commitb4e972b7297b8835cacfc7ded7170de96140ce37 (patch)
tree7406942cca3cfbc0af3dc2b900b917cb6fe98053 /ui/qt
parenteca15bf5ae681312e3e94eb7d1aca67e9c7c4b90 (diff)
Fix a bunch of leaks found by Valgrind.
Change-Id: I8862ed15d354aee487bacd80ab5fb4918423287e Reviewed-on: https://code.wireshark.org/review/10487 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/accordion_frame.cpp2
-rw-r--r--ui/qt/display_filter_edit.h2
-rw-r--r--ui/qt/file_set_dialog.h2
-rw-r--r--ui/qt/funnel_statistics.cpp4
-rw-r--r--ui/qt/funnel_statistics.h8
-rw-r--r--ui/qt/interface_tree.cpp2
-rw-r--r--ui/qt/main_welcome.h2
-rw-r--r--ui/qt/main_window.cpp16
-rw-r--r--ui/qt/main_window.h8
-rw-r--r--ui/qt/main_window_slots.cpp6
-rw-r--r--ui/qt/progress_frame.cpp23
-rw-r--r--ui/qt/progress_frame.h4
-rw-r--r--ui/qt/wireshark_application.cpp4
-rw-r--r--ui/qt/wireshark_application.h4
14 files changed, 48 insertions, 39 deletions
diff --git a/ui/qt/accordion_frame.cpp b/ui/qt/accordion_frame.cpp
index d7a587711e..9a0e7b3559 100644
--- a/ui/qt/accordion_frame.cpp
+++ b/ui/qt/accordion_frame.cpp
@@ -47,7 +47,7 @@ AccordionFrame::AccordionFrame(QWidget *parent) :
"}"
);
setStyleSheet(subframe_style);
- animation_ = new QPropertyAnimation(this, "maximumHeight");
+ animation_ = new QPropertyAnimation(this, "maximumHeight", this);
animation_->setDuration(duration_);
animation_->setEasingCurve(QEasingCurve::InOutQuad);
connect(animation_, SIGNAL(finished()), this, SLOT(animationFinished()));
diff --git a/ui/qt/display_filter_edit.h b/ui/qt/display_filter_edit.h
index 125b47f1bc..1c75492b7b 100644
--- a/ui/qt/display_filter_edit.h
+++ b/ui/qt/display_filter_edit.h
@@ -68,7 +68,7 @@ signals:
void pushFilterSyntaxStatus(const QString&);
void popFilterSyntaxStatus();
void pushFilterSyntaxWarning(const QString&);
- void filterPackets(QString& new_filter, bool force);
+ void filterPackets(QString new_filter, bool force);
};
#endif // DISPLAYFILTEREDIT_H
diff --git a/ui/qt/file_set_dialog.h b/ui/qt/file_set_dialog.h
index a3fe809b99..7035648d42 100644
--- a/ui/qt/file_set_dialog.h
+++ b/ui/qt/file_set_dialog.h
@@ -50,7 +50,7 @@ public:
void addFile(fileset_entry *entry = NULL);
signals:
- void fileSetOpenCaptureFile(QString &);
+ void fileSetOpenCaptureFile(QString);
private slots:
void on_buttonBox_helpRequested();
diff --git a/ui/qt/funnel_statistics.cpp b/ui/qt/funnel_statistics.cpp
index 9a5d830191..abbb4f37ce 100644
--- a/ui/qt/funnel_statistics.cpp
+++ b/ui/qt/funnel_statistics.cpp
@@ -161,7 +161,7 @@ const char *FunnelStatistics::displayFilter()
return display_filter_.constData();
}
-void FunnelStatistics::emitSetDisplayFilter(const QString &filter)
+void FunnelStatistics::emitSetDisplayFilter(const QString filter)
{
emit setDisplayFilter(filter);
}
@@ -176,7 +176,7 @@ void FunnelStatistics::emitApplyDisplayFilter()
emit applyDisplayFilter();
}
-void FunnelStatistics::emitOpenCaptureFile(QString &cf_path, QString &filter)
+void FunnelStatistics::emitOpenCaptureFile(QString cf_path, QString filter)
{
emit openCaptureFile(cf_path, filter);
}
diff --git a/ui/qt/funnel_statistics.h b/ui/qt/funnel_statistics.h
index 3f22bbb3de..d7df4e7e5b 100644
--- a/ui/qt/funnel_statistics.h
+++ b/ui/qt/funnel_statistics.h
@@ -40,16 +40,16 @@ public:
void retapPackets();
struct progdlg *progressDialogNew(const gchar *task_title, const gchar *item_title, gboolean terminate_is_stop, gboolean *stop_flag);
const char *displayFilter();
- void emitSetDisplayFilter(const QString &filter);
+ void emitSetDisplayFilter(const QString filter);
void reloadPackets();
void emitApplyDisplayFilter();
- void emitOpenCaptureFile(QString &cf_path, QString &filter);
+ void emitOpenCaptureFile(QString cf_path, QString filter);
static const QString &actionName() { return action_name_; }
signals:
- void setDisplayFilter(const QString &filter);
+ void setDisplayFilter(const QString filter);
void applyDisplayFilter();
- void openCaptureFile(QString &cf_path, QString &filter);
+ void openCaptureFile(QString cf_path, QString filter);
public slots:
void funnelActionTriggered();
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp
index 91301463dd..c9d58b8bfa 100644
--- a/ui/qt/interface_tree.cpp
+++ b/ui/qt/interface_tree.cpp
@@ -65,7 +65,7 @@ InterfaceTree::InterfaceTree(QWidget *parent) :
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAccessibleName(tr("Welcome screen list"));
- setItemDelegateForColumn(IFTREE_COL_STATS, new SparkLineDelegate());
+ setItemDelegateForColumn(IFTREE_COL_STATS, new SparkLineDelegate(this));
setDisabled(true);
ti = new QTreeWidgetItem();
diff --git a/ui/qt/main_welcome.h b/ui/qt/main_welcome.h
index 49d188488a..6e70aaef19 100644
--- a/ui/qt/main_welcome.h
+++ b/ui/qt/main_welcome.h
@@ -57,7 +57,7 @@ private:
signals:
void startCapture();
- void recentFileActivated(QString& cfile);
+ void recentFileActivated(QString cfile);
void pushFilterSyntaxStatus(const QString&);
void popFilterSyntaxStatus();
void captureFilterSyntaxChanged(bool valid);
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 3b515b8a91..e6c925e68e 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -280,14 +280,14 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(popFilterSyntaxStatus()), main_ui_->statusBar, SLOT(popFilterStatus()));
connect(df_edit, SIGNAL(pushFilterSyntaxWarning(const QString&)),
main_ui_->statusBar, SLOT(pushTemporaryStatus(const QString&)));
- connect(df_edit, SIGNAL(filterPackets(QString&,bool)), this, SLOT(filterPackets(QString&,bool)));
+ connect(df_edit, SIGNAL(filterPackets(QString,bool)), this, SLOT(filterPackets(QString,bool)));
connect(wsApp, SIGNAL(preferencesChanged()), df_edit, SLOT(checkFilter()));
connect(df_edit, SIGNAL(textChanged(QString)), funnel_statistics_, SLOT(displayFilterTextChanged(QString)));
connect(funnel_statistics_, SIGNAL(setDisplayFilter(QString)), df_edit, SLOT(setText(QString)));
connect(funnel_statistics_, SIGNAL(applyDisplayFilter()), df_combo_box_, SLOT(applyDisplayFilter()));
- connect(funnel_statistics_, SIGNAL(openCaptureFile(QString&,QString&)),
- this, SLOT(openCaptureFile(QString&,QString&)));
+ connect(funnel_statistics_, SIGNAL(openCaptureFile(QString,QString)),
+ this, SLOT(openCaptureFile(QString,QString)));
connect(this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
initMainToolbarIcons();
@@ -455,8 +455,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(main_welcome_, SIGNAL(startCapture()),
this, SLOT(startCapture()));
- connect(main_welcome_, SIGNAL(recentFileActivated(QString&)),
- this, SLOT(openCaptureFile(QString&)));
+ connect(main_welcome_, SIGNAL(recentFileActivated(QString)),
+ this, SLOT(openCaptureFile(QString)));
connect(main_welcome_, SIGNAL(pushFilterSyntaxStatus(const QString&)),
main_ui_->statusBar, SLOT(pushFilterStatus(const QString&)));
connect(main_welcome_, SIGNAL(popFilterSyntaxStatus()),
@@ -554,8 +554,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(main_ui_->statusBar, SIGNAL(editCaptureComment()),
this, SLOT(on_actionStatisticsCaptureFileProperties_triggered()));
- connect(&file_set_dialog_, SIGNAL(fileSetOpenCaptureFile(QString&)),
- this, SLOT(openCaptureFile(QString&)));
+ connect(&file_set_dialog_, SIGNAL(fileSetOpenCaptureFile(QString)),
+ this, SLOT(openCaptureFile(QString)));
#ifdef HAVE_LIBPCAP
QTreeWidget *iface_tree = findChild<QTreeWidget *>("interfaceTree");
@@ -1437,7 +1437,7 @@ void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compre
}
}
-bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) {
+bool MainWindow::testCaptureFileClose(bool from_quit, QString before_what) {
bool capture_in_progress = FALSE;
if (!capture_file_.capFile() || capture_file_.capFile()->state == FILE_CLOSED)
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index e36969b0ed..365648501d 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -169,7 +169,7 @@ private:
void exportDissections(export_type_e export_type);
void fileAddExtension(QString &file_name, int file_type, bool compressed);
- bool testCaptureFileClose(bool from_quit = false, QString& before_what = *new QString());
+ bool testCaptureFileClose(bool from_quit = false, QString before_what = QString());
void captureStop();
void initMainToolbarIcons();
@@ -215,9 +215,9 @@ public slots:
* @return True on success, false on failure.
*/
// XXX We might want to return a cf_read_status_t or a CaptureFile.
- bool openCaptureFile(QString& cf_path, QString& display_filter, unsigned int type);
- bool openCaptureFile(QString& cf_path = *new QString(), QString& display_filter = *new QString()) { return openCaptureFile(cf_path, display_filter, WTAP_TYPE_AUTO); }
- void filterPackets(QString& new_filter = *new QString(), bool force = false);
+ bool openCaptureFile(QString cf_path, QString display_filter, unsigned int type);
+ bool openCaptureFile(QString cf_path = QString(), QString display_filter = QString()) { return openCaptureFile(cf_path, display_filter, WTAP_TYPE_AUTO); }
+ void filterPackets(QString new_filter = QString(), bool force = false);
void updateForUnsavedChanges();
void layoutPanes();
void applyRecentPaneGeometry();
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 9abd2331d0..728b1876f6 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -156,7 +156,7 @@ static const char *dfe_property_ = "display filter expression"; //TODO : Fix Tra
// We're too lazy to sublcass QAction.
static const char *color_number_property_ = "color number";
-bool MainWindow::openCaptureFile(QString& cf_path, QString& read_filter, unsigned int type)
+bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned int type)
{
QString file_name = "";
dfilter_t *rfcode = NULL;
@@ -265,7 +265,7 @@ bool MainWindow::openCaptureFile(QString& cf_path, QString& read_filter, unsigne
return true;
}
-void MainWindow::filterPackets(QString& new_filter, bool force)
+void MainWindow::filterPackets(QString new_filter, bool force)
{
cf_status_t cf_status;
@@ -1137,7 +1137,7 @@ void MainWindow::setMenusForSelectedPacket()
QString filter;
if (capture_file_.capFile()->edt) {
enable = color_filter->is_filter_valid(&capture_file_.capFile()->edt->pi);
- filter = color_filter->build_filter_string(&capture_file_.capFile()->edt->pi);
+ filter = gchar_free_to_qstring(color_filter->build_filter_string(&capture_file_.capFile()->edt->pi));
}
conv_action->setEnabled(enable);
conv_action->setData(filter);
diff --git a/ui/qt/progress_frame.cpp b/ui/qt/progress_frame.cpp
index 43d9b3b231..a41db8d539 100644
--- a/ui/qt/progress_frame.cpp
+++ b/ui/qt/progress_frame.cpp
@@ -105,6 +105,8 @@ ProgressFrame::ProgressFrame(QWidget *parent) :
, stop_flag_(NULL)
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
, show_timer_(-1)
+ , effect_(NULL)
+ , animation_(NULL)
#endif
#ifdef QWINTASKBARPROGRESS_H
, update_taskbar_(false)
@@ -140,6 +142,12 @@ ProgressFrame::ProgressFrame(QWidget *parent) :
" max-width: 1em;"
"}"
);
+
+#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+ effect_ = new QGraphicsOpacityEffect(this);
+ animation_ = new QPropertyAnimation(effect_, "opacity", this);
+#endif
+
connect(this, SIGNAL(showRequested(bool,bool,gboolean*)),
this, SLOT(show(bool,bool,gboolean*)));
hide();
@@ -230,16 +238,13 @@ void ProgressFrame::timerEvent(QTimerEvent *event)
killTimer(show_timer_);
show_timer_ = -1;
- QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
- this->setGraphicsEffect(effect);
-
- QPropertyAnimation *animation = new QPropertyAnimation(effect, "opacity");
+ this->setGraphicsEffect(effect_);
- animation->setDuration(750);
- animation->setStartValue(0.1);
- animation->setEndValue(1.0);
- animation->setEasingCurve(QEasingCurve::InOutQuad);
- animation->start();
+ animation_->setDuration(750);
+ animation_->setStartValue(0.1);
+ animation_->setEndValue(1.0);
+ animation_->setEasingCurve(QEasingCurve::InOutQuad);
+ animation_->start();
QFrame::show();
}
diff --git a/ui/qt/progress_frame.h b/ui/qt/progress_frame.h
index 997f5434f1..65ea72a9b7 100644
--- a/ui/qt/progress_frame.h
+++ b/ui/qt/progress_frame.h
@@ -37,6 +37,8 @@ class ProgressFrame;
class ProgressFrame;
class QDialogButtonBox;
+class QGraphicsOpacityEffect;
+class QPropertyAnimation;
// Define the structure describing a progress dialog.
struct progdlg {
@@ -86,6 +88,8 @@ private:
gboolean *stop_flag_;
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
int show_timer_;
+ QGraphicsOpacityEffect *effect_;
+ QPropertyAnimation *animation_;
#endif
#ifdef QWINTASKBARPROGRESS_H
bool update_taskbar_;
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 2625950f9b..3dc8297143 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -193,7 +193,7 @@ void WiresharkApplication::refreshRecentFiles(void) {
continue;
}
- rf_status = new RecentFileStatus(ri->filename);
+ rf_status = new RecentFileStatus(ri->filename, this);
connect(rf_status, SIGNAL(statusFound(QString, qint64, bool)),
this, SLOT(itemStatusFinished(QString, qint64, bool)), Qt::QueuedConnection);
@@ -981,7 +981,7 @@ QList<recent_item_status *> WiresharkApplication::recentItems() const {
return recent_items_;
}
-void WiresharkApplication::addRecentItem(const QString &filename, qint64 size, bool accessible) {
+void WiresharkApplication::addRecentItem(const QString filename, qint64 size, bool accessible) {
recent_item_status *ri = new(recent_item_status);
ri->filename = filename;
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index 8340581e77..807fb84a80 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -94,7 +94,7 @@ public:
void refreshLocalInterfaces();
struct _e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path);
QList<recent_item_status *> recentItems() const;
- void addRecentItem(const QString &filename, qint64 size, bool accessible);
+ void addRecentItem(const QString filename, qint64 size, bool accessible);
QDir lastOpenDir();
void setLastOpenDir(const char *dir_name);
void setLastOpenDir(QString *dir_str);
@@ -136,7 +136,7 @@ protected:
signals:
void appInitialized();
void localInterfaceListChanged();
- void openCaptureFile(QString &cf_path, QString &display_filter, unsigned int type);
+ void openCaptureFile(QString cf_path, QString display_filter, unsigned int type);
void recentFilesRead();
void updateRecentItemStatus(const QString &filename, qint64 size, bool accessible);
void splashUpdate(register_action_e action, const char *message);