mirror of
https://github.com/linuxdeepin/gio-qt.git
synced 2025-03-04 06:34:41 +01:00
fix: crash when calling DGioSettings::setValue
Though whether key is actually existed has been judged in DGioSettingsPrivate::trySet, when calling g_settings_get_value, 'gkey' still seems to be empty or NULL. Not sure what happened when converted from QString to gchar* Log: Use DGioPrivate::convertToGChar to replace QString::toUtf8().constData() in DGioSettingsPrivate::trySet, just like DGioSettingsPrivate::value
This commit is contained in:
parent
c22fc13355
commit
5b0af3856b
1 changed files with 6 additions and 2 deletions
|
@ -205,9 +205,12 @@ public:
|
||||||
|
|
||||||
bool trySet(const QString& key, const QVariant& value)
|
bool trySet(const QString& key, const QVariant& value)
|
||||||
{
|
{
|
||||||
const gchar* gkey = key.toUtf8().constData();
|
gchar* gkey = DGioPrivate::converToGChar(key.toUtf8());
|
||||||
|
|
||||||
if(!inlcudeKey(gkey)) return false;
|
if(!inlcudeKey(gkey)) {
|
||||||
|
g_free(gkey);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
@ -221,6 +224,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
g_variant_unref(cur);
|
g_variant_unref(cur);
|
||||||
|
g_free(gkey);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue