fix: adjust `Glib::ustring` creation in a few places (#4859)

From what I observed, ctor accepting `(begin, end)` is getting called
instead of one accepting `(data, size)` for no apparent reason in some
cases. Switch to a ctor accepting a `std::string` in those problematic
places.
This commit is contained in:
Mike Gelfand 2023-02-13 20:16:15 +03:00 committed by GitHub
parent 05dded12a0
commit 25b50a7dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -1296,9 +1296,7 @@ void Application::Impl::on_prefs_changed(tr_quark const key)
{
bool const b = gtr_pref_flag_get(key);
tr_sessionUseAltSpeed(tr, b);
auto const key_sv = tr_quark_get_string_view(key);
auto const key_ustr = Glib::ustring{ std::data(key_sv), std::size(key_sv) };
gtr_action_set_toggled(key_ustr, b);
gtr_action_set_toggled(std::string(tr_quark_get_string_view(key)), b);
break;
}

View File

@ -1215,8 +1215,8 @@ void initPeerRow(
(*iter)[peer_cols.address_collated] = collated_name;
(*iter)[peer_cols.client] = client;
(*iter)[peer_cols.encryption_stock_id] = peer->isEncrypted ? "lock" : "";
(*iter)[peer_cols.key] = Glib::ustring{ std::data(key), std::size(key) };
(*iter)[peer_cols.torrent_name] = Glib::ustring{ std::data(torrent_name), std::size(torrent_name) };
(*iter)[peer_cols.key] = std::string(key);
(*iter)[peer_cols.torrent_name] = std::string(torrent_name);
}
void refreshPeerRow(Gtk::TreeModel::iterator const& iter, tr_peer_stat const* peer)