Browse Source

Fix ConsoleTrigger memory leak

Adam Johnson 10 years ago
parent
commit
4e35dbf528
  1. 10
      Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp
  2. 5
      Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h
  3. 8
      Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp

10
Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp

@ -368,11 +368,11 @@ PF_CONSOLE_CMD( Avatar_Multistage, Trigger, "string multiComp", "Triggers the na
// Setup the event data in case this is a OneShot responder that needs it
plKey playerKey = plAvatarMgr::GetInstance()->GetLocalAvatar()->GetKey();
proPickedEventData *ed = new proPickedEventData;
ed->fPicker = playerKey;
ed->fPicked = key; // ???
msg->AddEvent(ed);
proPickedEventData ed;
ed.fPicker = playerKey;
ed.fPicked = key; // ???
msg->AddEvent(&ed);
// Send it to the responder modifier
msg->AddReceiver(key);
plgDispatch::MsgSend(msg);

5
Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h

@ -370,7 +370,10 @@ public:
void SetType(notificationType type) { fType = type; }
void SetState(float state) { fState = state; }
// event records for the notify message
/**
* Adds an arbitrary event to this notify message.
* \note This copies \a ed.
*/
void AddEvent( proEventData* ed);
void AddCollisionEvent( bool enter, const plKey &other, const plKey &self, bool onlyOneCollision=true );
void AddPickEvent( const plKey &other, const plKey& self, bool enabled, hsPoint3 hitPoint );

8
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp

@ -56,10 +56,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
void plLogicModBase::ConsoleTrigger(plKey playerKey)
{
// Setup the event data in case this is a OneShot responder that needs it
proPickedEventData *ed = new proPickedEventData;
ed->fPicker = playerKey;
ed->fPicked = nil;
fNotify->AddEvent(ed);
proPickedEventData ed;
ed.fPicker = playerKey;
ed.fPicked = nullptr;
fNotify->AddEvent(&ed);
Trigger(false);

Loading…
Cancel
Save