diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-06-02 15:05:45 -0400 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-06-02 19:50:20 -0400 |
commit | c41451af75520a19b050347bb9c267b69773ff0a (patch) | |
tree | ba77ef44510bcc5e31bc686328f3f9d152bbafb4 /src/yuzu/configuration/config.cpp | |
parent | 377cd301b30aaee015d6981387284ab5cbd7cc3e (diff) |
yuzu qt: Revert some usages of string_view
Causes a heap-use-after free reported by AddressSanitizer. This makes
use of std::filesystem::path, but due to that we have to use their
string() function which may not work for all characters.
Diffstat (limited to 'src/yuzu/configuration/config.cpp')
-rw-r--r-- | src/yuzu/configuration/config.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 552454acf2..e9d4bef607 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -16,7 +16,7 @@ namespace FS = Common::FS; -Config::Config(std::string_view config_name, ConfigType config_type) : type(config_type) { +Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) { global = config_type == ConfigType::GlobalConfig; Initialize(config_name); @@ -242,7 +242,7 @@ const std::array<UISettings::Shortcut, 17> Config::default_hotkeys{{ }}; // clang-format on -void Config::Initialize(std::string_view config_name) { +void Config::Initialize(const std::string& config_name) { const auto fs_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir); const auto config_file = fmt::format("{}.ini", config_name); @@ -255,7 +255,8 @@ void Config::Initialize(std::string_view config_name) { Reload(); break; case ConfigType::PerGameConfig: - qt_config_loc = FS::PathToUTF8String(fs_config_loc / "custom" / config_file); + qt_config_loc = + FS::PathToUTF8String(fs_config_loc / "custom" / FS::ToU8String(config_file)); void(FS::CreateParentDir(qt_config_loc)); qt_config = std::make_unique<QSettings>(QString::fromStdString(qt_config_loc), QSettings::IniFormat); |