From cbe9ef24b9decb6eff25835810dfd865a3153de6 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 9 Apr 2020 00:03:19 +1000 Subject: [PATCH] SettingWidgetBinder: Use QString instead of const char* Fixes potential string lifetime issues. --- src/duckstation-qt/settingwidgetbinder.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index b58831911..798a3c831 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -136,7 +136,7 @@ struct SettingAccessor /// Binds a widget's value to a setting, updating it when the value changes. template -void BindWidgetToBoolSetting(QtHostInterface* hi, WidgetType* widget, const char* setting_name) +void BindWidgetToBoolSetting(QtHostInterface* hi, WidgetType* widget, const QString& setting_name) { using Accessor = SettingAccessor; @@ -150,7 +150,7 @@ void BindWidgetToBoolSetting(QtHostInterface* hi, WidgetType* widget, const char } template -void BindWidgetToIntSetting(QtHostInterface* hi, WidgetType* widget, const char* setting_name) +void BindWidgetToIntSetting(QtHostInterface* hi, WidgetType* widget, const QString& setting_name) { using Accessor = SettingAccessor; @@ -164,7 +164,7 @@ void BindWidgetToIntSetting(QtHostInterface* hi, WidgetType* widget, const char* } template -void BindWidgetToNormalizedSetting(QtHostInterface* hi, WidgetType* widget, const char* setting_name, float range) +void BindWidgetToNormalizedSetting(QtHostInterface* hi, WidgetType* widget, const QString& setting_name, float range) { using Accessor = SettingAccessor; @@ -178,7 +178,7 @@ void BindWidgetToNormalizedSetting(QtHostInterface* hi, WidgetType* widget, cons } template -void BindWidgetToStringSetting(QtHostInterface* hi, WidgetType* widget, const char* setting_name) +void BindWidgetToStringSetting(QtHostInterface* hi, WidgetType* widget, const QString& setting_name) { using Accessor = SettingAccessor; @@ -192,7 +192,7 @@ void BindWidgetToStringSetting(QtHostInterface* hi, WidgetType* widget, const ch } template -void BindWidgetToEnumSetting(QtHostInterface* hi, WidgetType* widget, const char* setting_name, +void BindWidgetToEnumSetting(QtHostInterface* hi, WidgetType* widget, const QString& setting_name, std::optional (*from_string_function)(const char* str), const char* (*to_string_function)(DataType value)) {