From 67b069e544da2078cf5c9ba0c95ca9af8ba00b03 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 29 Jan 2015 13:55:18 -0800 Subject: Qt: Add address conversion convenience routines Add address_to_qstring and address_to_display_qstring, which wrap address_to_string and address_to_display respectively and return QStrings. Convert most of the instances in ui/qt to the new routines. Fix a some memory leaks in the process. Change-Id: Icda80bbfe0b2df723d54c8da84355255f819af89 Reviewed-on: https://code.wireshark.org/review/6848 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- doc/README.qt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doc/README.qt') diff --git a/doc/README.qt b/doc/README.qt index 754a8ea60d..02ed43abe6 100644 --- a/doc/README.qt +++ b/doc/README.qt @@ -196,11 +196,15 @@ QEvent::LanguageChange. If you're using GLib string functions or plain old C character array idioms in Qt-only code you're probably doing something wrong. QStrings are generally -*much* safer and easier to use. They also make translations eaiser. +*much* safer and easier to use. They also make translations easier. If you need to pass strings between Qt and GLib you can use qstring_strdup gchar_free_to_qstring, which are defined in ui/qt/qt_ui_utils.h. +If you're calling a function that returns wmem-allocated memory it might make +more sense to add a wrapper function to qt_ui_utils than to call wmem_free in +your code. + 2.1.4 Mixing C and C++ Sometimes we have to call C++ functions from one of Wireshark's C callbacks and -- cgit v1.2.3