Fix a runtime access violation in tfdum

This commit is contained in:
Ben Walden
2020-09-28 17:26:47 +01:00
parent 01b7a56095
commit 9bc108f8b8
4 changed files with 12 additions and 10 deletions

View File

@@ -145,7 +145,7 @@ StunEndPoint::generateBindingResponse(const Uri& mappedAddress)
{
return new CommonAction(this,
"Generate Binding Response",
[&] { generateBindingResponseDelegate(mappedAddress); });
[=] { generateBindingResponseDelegate(mappedAddress); });
}
ActionBase*

View File

@@ -3,6 +3,8 @@
//#include "tfm/tfdum/DumEvent.hxx"
//#include "rutil/Logger.hxx"
#include <utility>
#define RESIPROCATE_SUBSYSTEM resip::Subsystem::TEST
using namespace resip;
@@ -62,14 +64,14 @@ Shutdown::operator()(DumUserAgent& dua)
DumUaSendingCommand::DumUaSendingCommand(DumUserAgent* dua, Functor func) :
DumUaAction(dua),
mFunctor(func),
mMessageAdorner(0)
mFunctor(std::move(func)),
mMessageAdorner(nullptr)
{
}
DumUaSendingCommand::DumUaSendingCommand(DumUserAgent* dua, Functor func, MessageAdorner* adorner) :
DumUaAction(dua),
mFunctor(func),
mFunctor(std::move(func)),
mMessageAdorner(adorner)
{
}
@@ -83,11 +85,11 @@ void
DumUaSendingCommand::operator()(DumUserAgent& dua)
{
dua.getDum().post(new DumUaSendingCommandCommand(dua.getDum(), mFunctor, mMessageAdorner));
mMessageAdorner=0;
mMessageAdorner = nullptr;
}
DumUaSendingCommandCommand::DumUaSendingCommandCommand(resip::DialogUsageManager& dum, Functor func, MessageAdorner* adorn) :
mFunctor(func),
mFunctor(std::move(func)),
mMessageAdorner(adorn),
mDum(dum)
{}
@@ -120,7 +122,7 @@ DumUaSendingCommandCommand::executeCommand()
DumUaCommand::DumUaCommand(DumUserAgent* dua, Functor func) :
DumUaAction(dua),
mFunctor(func)
mFunctor(std::move(func))
{
}

View File

@@ -387,7 +387,7 @@ DumUserAgent::inviteFromRefer(const resip::SipMessage& refer,
resip::DialogUsageManager::EncryptionLevel level,
const resip::SdpContents* alternative)
{
return new DumUaSendingCommand(this, [&] { return mDum->makeInviteSessionFromRefer(refer, h, initialOffer, level, alternative, nullptr); });
return new DumUaSendingCommand(this, [=, &refer, &h] { return mDum->makeInviteSessionFromRefer(refer, h, initialOffer, level, alternative, nullptr); });
}
DumUaAction*
@@ -400,7 +400,7 @@ DumUaAction*
DumUserAgent::publish(const resip::NameAddr& target, const resip::Contents& body,
const resip::Data& eventType, unsigned expiresSeconds)
{
return new DumUaSendingCommand(this, [&] { return mDum->makePublication(target, body, eventType, expiresSeconds, nullptr); });
return new DumUaSendingCommand(this, [=, &body] { return mDum->makePublication(target, body, eventType, expiresSeconds, nullptr); });
}
DumUaAction*

View File

@@ -24,7 +24,7 @@ TestClientPagerMessage::TestClientPagerMessage(DumUserAgent* ua, ClientPagerMess
CommonAction*
TestClientPagerMessage::page(std::unique_ptr<resip::Contents>& contents, resip::DialogUsageManager::EncryptionLevel level)
{
return new CommonAction(mUa, "page", [&] { mHandle->page(std::move(contents), level); });
return new CommonAction(mUa, "page", [=, &contents] { mHandle->page(std::move(contents), level); });
}
CommonAction*