From ccae3d7ccd850b1f4dc98414438c790640ae5685 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Fri, 26 Aug 2022 03:51:13 +0300 Subject: [PATCH] Fix GTK client crash opening message log containing errors (#3711) `Glib::ustring::sprintf()` doesn't support formatting `std::string_view`. Use `fmt::format()` instead. Broken in #3626 (7c5862a5f5). --- gtk/MessageLogWindow.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/MessageLogWindow.cc b/gtk/MessageLogWindow.cc index 6c4dd88aa..b581b2e40 100644 --- a/gtk/MessageLogWindow.cc +++ b/gtk/MessageLogWindow.cc @@ -362,11 +362,11 @@ tr_log_message* addMessages(Glib::RefPtr const& store, tr_log_me /* if it's an error message, dump it to the terminal too */ if (i->level == TR_LOG_ERROR) { - auto gstr = gtr_sprintf("%s:%d %s", i->file, i->line, i->message); + auto gstr = fmt::format("{}:{} {}", i->file, i->line, i->message); if (!std::empty(i->name)) { - gstr += gtr_sprintf(" (%s)", i->name.c_str()); + gstr += fmt::format(" ({})", i->name.c_str()); } g_warning("%s", gstr.c_str());