diff --git a/server/WebApi.h b/server/WebApi.h index 255ccfcf67..4a87a189d3 100755 --- a/server/WebApi.h +++ b/server/WebApi.h @@ -115,13 +115,25 @@ std::string getValue(const mediakit::Parser &parser, Args &args, const First &fi template class HttpAllArgs { + mediakit::Parser* _parser = nullptr; + Args* _args = nullptr; public: const mediakit::Parser& parser; Args& args; HttpAllArgs(const mediakit::Parser &parser, Args &args): parser(parser), args(args) {} - HttpAllArgs(const HttpAllArgs &that): parser(that.parser), args(that.args) {} + HttpAllArgs(const HttpAllArgs &that): _parser(new mediakit::Parser(that.parser)), + _args(new Args(that.args)), + parser(*_parser), args(*_args) {} + ~HttpAllArgs() { + if (_parser) { + delete _parser; + } + if (_args) { + delete _args; + } + } template toolkit::variant operator[](const Key &key) const {