janbar/noson

:ConnectZone terminate with 'std::bad_alloc'

daniwebCH opened this issue · 2 comments

I get this:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

THis occurs when I make a discover and I call l bool System::ConnectZone(const ZonePtr& zone, void* CBHandle, EventCB eventCB) I see that a new Player(zone, m_eventHandler, CBHandle, eventCB) is connected.

What shall I do to prevent it ?
Would it be a good idea in System::ConnectZone to destry an eventual player stored at m_connectedZone.player ?

Any more details ? A gdb stack trace or a snippet of your code ...

Would it be a good idea in System::ConnectZone to destry an eventual player stored at m_connectedZone.player ?

It is a shared pointer (PlayerPtr) and it will be destroy under the hood once no longer referenced.
In noson all types "*Ptr" are shared pointer and you haven't need to handle freeing.