[haiku-appserver] Re: deadlock

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Wed, 06 Apr 2005 11:28:18 +0200 CEST


>       While playing yesterday I found a "pretty nice" situation.
>       You can reproduce it by adding a single line:
> MoveBy(10,10);


>       Looks to me StringWidth() is not implemented well. I tested this
> on R5 and it works.
>       The reason: when you create a BApplication object its looper is
> locked until you call ::Run(). StringWidth() uses 
> BApplication's server connection and for that it must acquire
> BApplication's lock. Because StringWidth() is called from 
> BWindow's thread we get a deadlock.
>       Don't know how this should be solved... I guess we should use
> BWindow for getting font data. Just a thought.

If you try this on R5, you should be thrown into the debugger with "The 
looper must be locked." I would assume that the window link should be 
used instead of the applications for StringWidth(). Because normally, 
the window is the one which you would lock. The thing I don't get is 
how BView::StringWidth() is related to BWindow::MoveBy().

Best regards,

Other related posts: