Merge pull request #1080 from eightyeight/netevent-reference-counting

Use a strong reference instead of more manual reference counting
This commit is contained in:
Luis Anton Rebollo 2015-01-24 23:03:33 +01:00
commit 94f5e6d9dc

View file

@ -310,8 +310,8 @@ void NetConnection::eventReadPacket(BitStream *bstream)
setLastError("Invalid packet. (bad event class id)");
return;
}
NetEvent *evt = (NetEvent *) ConsoleObject::create(getNetClassGroup(), NetClassTypeEvent, classId);
if(!evt)
StrongRefPtr<NetEvent> evt = (NetEvent *) ConsoleObject::create(getNetClassGroup(), NetClassTypeEvent, classId);
if(evt.isNull())
{
setLastError("Invalid packet. (bad ghost class id)");
return;
@ -344,7 +344,7 @@ void NetConnection::eventReadPacket(BitStream *bstream)
if(unguaranteedPhase)
{
evt->process(this);
evt->decRef();
evt = NULL;
if(mErrorBuffer.isNotEmpty())
return;
continue;