fix use of invalidated pointer in rpcipml
This commit is contained in:
parent
b5fd47e219
commit
114885d67b
|
@ -903,7 +903,6 @@ void addTorrentInfo(tr_torrent* tor, TrFormat format, tr_variant* entry, tr_quar
|
|||
char const* torrentGet(tr_session* session, tr_variant* args_in, tr_variant* args_out, tr_rpc_idle_data* /*idle_data*/)
|
||||
{
|
||||
auto const torrents = getTorrents(session, args_in);
|
||||
tr_variant* const list = tr_variantDictAddList(args_out, TR_KEY_torrents, std::size(torrents) + 1);
|
||||
|
||||
auto sv = std::string_view{};
|
||||
auto const format = tr_variantDictFindStrView(args_in, TR_KEY_format, &sv) && sv == "table"sv ? TrFormat::Table :
|
||||
|
@ -945,6 +944,8 @@ char const* torrentGet(tr_session* session, tr_variant* args_in, tr_variant* arg
|
|||
}
|
||||
}
|
||||
|
||||
auto* const list = tr_variantDictAddList(args_out, TR_KEY_torrents, std::size(torrents) + 1U);
|
||||
|
||||
if (format == TrFormat::Table)
|
||||
{
|
||||
/* first entry is an array of property names */
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <cstddef> // size_t
|
||||
#include <cstdint> // int64_t
|
||||
#include <optional>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits> // std::is_same_v
|
||||
|
@ -102,9 +103,9 @@ public:
|
|||
return std::empty(vec_);
|
||||
}
|
||||
|
||||
void reserve(size_t new_cap)
|
||||
void reserve(size_t const new_cap)
|
||||
{
|
||||
vec_.reserve(new_cap);
|
||||
vec_.reserve(std::max(new_cap, size_t{ 16U }));
|
||||
}
|
||||
|
||||
auto erase(tr_quark const key)
|
||||
|
|
Loading…
Reference in New Issue