Skip to content

Commit

Permalink
fix for HttpAllArgs copy ctor and dtor
Browse files Browse the repository at this point in the history
  • Loading branch information
johzzy committed Mar 17, 2024
1 parent 6143c31 commit 30d39d3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion server/WebApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,25 @@ std::string getValue(const mediakit::Parser &parser, Args &args, const First &fi

template<typename Args>
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<typename Key>
toolkit::variant operator[](const Key &key) const {
Expand Down

0 comments on commit 30d39d3

Please sign in to comment.