[haiku-gsoc] Re: haiku-gsoc Digest V4 #22

  • From: Clemens <czei002@xxxxxxxxxxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Thu, 30 Jun 2011 12:41:41 +1200

On Wed, 29 Jun 2011 08:19:44 +1200, Stephan Aßmus <superstippi@xxxxxx> wrote:


completely avoid these headaches. On top of what Rene said, you can also safely invoke someBWindowPointer->PostMessage(), even if someBWindowPointer is stale and points to an already freed BWindow. This is some behind the scenes magic happening in PostMessage(), which prevents dereferencing stale BLooper pointers by means of looking it up in a list of valid BLoopers first. But let's not get distracted. If you stick to messaging like in my example code, you don't need

I think Axel pointed it out already recently, the window could go away and a new window is allocated at the same pointer address, in this case the message will go to wrong window...

Maybe a cached BMessenger could be used to post the message safely...

Regards,
        Clemens

Other related posts: