[interfacekit] Re: BHandler::fToken

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: interfacekit@xxxxxxxxxxxxx
  • Date: Mon, 10 Mar 2003 23:38:32 +0100 CET

"Marc Flerackers" <mflerackers@xxxxxxxxxx> wrote:
> Why would they be invalid, well, lets say a developer overwrites the 
> memory
> in a wrong place, like BView::server=5Ftoken, this would cause a wrong 
> token
> to be sent to the server. So to keep the server from crashing in such 
> case,
> it looks up the token to see if it's valid. No one keeps you from 
> storing
> the pointer as a key in the hash table. As long as your keys are 
> unique you
> can use any value you prefer.

As long as this would only crash the application, that wouldn't be a 
problem - the server however, should always live on the safe side.

> The only point I see with using pointers is that a new object can get 
> the
> same address as one that was deleted previously, which can cause 
> problems
> since an invalid reference could be seen as a valid one. This could 
> make a
> mess in a multithreaded environment.

That's true, and that's a very good reason for using the tokens - they 
can be unique throughout the lifetime of a process.

Adios...
   Axel.



Other related posts: