Cuberite Forum
[FIXED] cPlayer with NULL pointer to cClientHandle - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: [FIXED] cPlayer with NULL pointer to cClientHandle (/thread-380.html)



[FIXED] cPlayer with NULL pointer to cClientHandle - FakeTruth - 03-07-2012

Apparently sometimes a player still has a NULL pointer to its cClientHandle.

I noticed this in cFurnaceEntity::Tick line 187
It tries to send a cooking progress packet to a NULL pointer

This is just a reminder for me, I'll have to investigate later


RE: cPlayer with NULL pointer to cClientHandle - xoft - 03-07-2012

cClientHandle's destructor sets cPlayer's m_ClientHandle to NULL just before detaching itself from the player object. This might be the cause.

I'd say, remove the cPlayer::SetClientHandle altogether and set the cPlayer's clienthandle to NULL in its Destroy() method. Then you'll see if there have been any more calls to SetClientHandle().
And of course you can put asserts everywhere Smile


RE: cPlayer with NULL pointer to cClientHandle - FakeTruth - 03-07-2012

These are all references to SetClientHandle, so really it's only called once from the cClientHandle destructor
[Image: Screenshot-2012-03-07_13.03.59.png]

You're right about removing it, it's called together with Destroy() anyway


RE: cPlayer with NULL pointer to cClientHandle - xoft - 03-07-2012

Well, I've seen VS's "Call browser" fail too many a time, so I don't trust it anymore Wink Removing the function implementation is the easiest way to tell Smile


RE: cPlayer with NULL pointer to cClientHandle - FakeTruth - 03-07-2012

It's Visual Assist's reference finder thingy Wink Much better.