From f4f481fe38330fc18b7066285cf72ec546574e9f Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 15 Apr 2023 13:21:47 -0700 Subject: [PATCH] =?UTF-8?q?Bug=20798812=20-=20crashes=20after=20I=20open?= =?UTF-8?q?=20a=20customer=20report=20and=20select=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edit/Report Options As a result of auto instead of auto& in a std::visit call which resulted in a temporary option whose GncOwner* was destroyed before we could use it. --- libgnucash/engine/gnc-option.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgnucash/engine/gnc-option.cpp b/libgnucash/engine/gnc-option.cpp index 81ce571b48..f43fd778d3 100644 --- a/libgnucash/engine/gnc-option.cpp +++ b/libgnucash/engine/gnc-option.cpp @@ -47,7 +47,7 @@ template ValueType GncOption::get_value() const { return std::visit( - [](const auto option)->ValueType { + [](const auto& option)->ValueType { if constexpr (is_same_decayed_v) return option.get_value(); @@ -80,7 +80,7 @@ template ValueType GncOption::get_default_value() const { return std::visit( - [](const auto option)->ValueType { + [](const auto& option)->ValueType { if constexpr (is_same_decayed_v) return option.get_default_value();