diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-11-29 19:32:30 +0100 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2014-12-01 01:13:54 +0000 |
commit | cd14ff3288232273433fec1363d5adab38afdb2c (patch) | |
tree | 910cb2d8ad2f9faf4fc9f8cd8039c106173f4599 /ui/qt/column_preferences_frame.cpp | |
parent | 0cf2f74814708b46e6b7f1481fe41295abeb3721 (diff) | |
download | wireshark-cd14ff3288232273433fec1363d5adab38afdb2c.tar.gz |
qt: use qstring_strdup
Replaces the more verbose `g_strdup(foo.toUtf8().constData())` by
`qstring_strdup(foo)`. While at it, plug a minor memleak in
MainWindow dialogs.
Change-Id: I32b53f972b4e3998ac9beabd98647a381b7b42e3
Reviewed-on: https://code.wireshark.org/review/5531
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/column_preferences_frame.cpp')
-rw-r--r-- | ui/qt/column_preferences_frame.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/qt/column_preferences_frame.cpp b/ui/qt/column_preferences_frame.cpp index 42a148946c..f11dda65ed 100644 --- a/ui/qt/column_preferences_frame.cpp +++ b/ui/qt/column_preferences_frame.cpp @@ -32,6 +32,7 @@ #include <ui/preference_utils.h> +#include "qt_ui_utils.h" #include "column_preferences_frame.h" #include "ui_column_preferences_frame.h" #include "syntax_line_edit.h" @@ -85,7 +86,7 @@ void ColumnPreferencesFrame::unstash() while (*it) { fmt_data *cfmt = g_new0(fmt_data, 1); - cfmt->title = g_strdup((*it)->text(title_col_).toUtf8().constData()); + cfmt->title = qstring_strdup((*it)->text(title_col_)); cfmt->fmt = (*it)->data(type_col_, Qt::UserRole).value<int>(); cfmt->visible = (*it)->checkState(visible_col_) == Qt::Checked ? TRUE : FALSE; cfmt->resolved = TRUE; @@ -93,7 +94,7 @@ void ColumnPreferencesFrame::unstash() if (cfmt->fmt == COL_CUSTOM) { bool ok; int occurrence = (*it)->text(custom_occurrence_col_).toInt(&ok); - cfmt->custom_field = g_strdup((*it)->text(custom_field_col_).toUtf8().constData()); + cfmt->custom_field = qstring_strdup((*it)->text(custom_field_col_)); cfmt->custom_occurrence = ok ? occurrence : 0; } |