C++ Error Reading Register Value, can't debug

1.5k views Asked by At

I've got an issue with this piece of code, using Visual Studio 2012 C++ Express:

double clearbuffer(double buffid)
{
  CBuffer*buff = (CBuffer*)buffers.item((int)buffid);
  if(buff == NULL)return 0;
  buff->clear();
  return 1;
}

Basically this function is called quite often on my C++ Game Server. It's used to clear the buffer before writing any new data to it (buffer for sending data over the internet). The thing is, this error happens so randomly. The times it has happened I wasn't able to see if it was an exception or what because as soon as it came up I must have stopped debugging with a keyboard shortcut or something.

However, in the locals, I noticed the value for the buffid variable:

buffid ------- Error Reading Register Value

It said "Error Reading Register Value" for its value. Is there a reason for why this might come up? I'm assuming this was an access violation but I'm not sure.

Also I noticed before I stopped execution, that the debugger stopped on this line:

buff->clear();

I can't debug this because it rarely happens and it causes my server to stop completely, thus having to have it restarted, which disrupts gameplay for the clients connected to it.

Please tell me if I need to provide any more code and I will quickly edit my first post.

0

There are 0 answers