Fix memory leak in QGtk3Interface::themeName
Change-Id: Ib8c90f7ef66c095f0c1fc04f4cc72bf5eea72ddb Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 233e7e6be35a5a455b6ecd7c15de8c9cfc70ca10) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
57a7efe4dd
commit
55d3a2442c
@ -475,15 +475,18 @@ QBrush QGtk3Interface::brush(QGtkWidget wtype, QGtkColorSource source, GtkStateF
|
|||||||
\internal
|
\internal
|
||||||
\brief Returns the name of the current GTK theme.
|
\brief Returns the name of the current GTK theme.
|
||||||
*/
|
*/
|
||||||
const QString QGtk3Interface::themeName() const
|
QString QGtk3Interface::themeName() const
|
||||||
{
|
{
|
||||||
gchar *theme_name;
|
QString name;
|
||||||
GtkSettings *settings = gtk_settings_get_default();
|
|
||||||
if (!settings)
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
g_object_get(settings, "gtk-theme-name", &theme_name, nullptr);
|
if (GtkSettings *settings = gtk_settings_get_default()) {
|
||||||
return QLatin1StringView(theme_name);
|
gchar *theme_name;
|
||||||
|
g_object_get(settings, "gtk-theme-name", &theme_name, nullptr);
|
||||||
|
name = QLatin1StringView(theme_name);
|
||||||
|
g_free(theme_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -134,7 +134,7 @@ public:
|
|||||||
QIcon fileIcon(const QFileInfo &fileInfo) const;
|
QIcon fileIcon(const QFileInfo &fileInfo) const;
|
||||||
|
|
||||||
// Return current GTK theme name
|
// Return current GTK theme name
|
||||||
const QString themeName() const;
|
QString themeName() const;
|
||||||
|
|
||||||
// Derive color scheme from default colors
|
// Derive color scheme from default colors
|
||||||
Qt::ColorScheme colorSchemeByColors() const;
|
Qt::ColorScheme colorSchemeByColors() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user