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

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Tue, 28 Jun 2011 13:55:26 -0400

On Tue, Jun 28, 2011 at 1:42 PM, Nathan Heisey <nathanheisey@xxxxxxxxx> wrote:
> Does this work the other way around, too?  I have a number of functions that
> will be called from a driver object (presumably from the application thread,
> although I'm not completely sure) corresponding to window actions (examples
> are BE_Show/HideWindow and BE_MinimizeWindow).  So far I've just been
> calling the BWindow functions directly.

They *can* be called from outside the window, but you'd have to ensure
that the window is locked first. Assuming you have control over when
the windows quit (i.e. if you implement Stephan's suggestion to
forward the window's quit requests to the app thread so the latter can
handle terminating the window), then it's reasonably safe to just use
window->Lock()/Unlock() pairs around the calls in question, otherwise
you would want to use a method like BMessenger's LockTarget() which
safely deals with the window object no longer existing.

Regards,

Rene

Other related posts: