
|
[haiku-appserver]
||
[Date Prev]
[04-2005 Date Index]
[Date Next]
||
[Thread Prev]
[04-2005 Thread Index]
[Thread Next]
[haiku-appserver] Re: deadlock
- From: Adi Oanca <adioanca@xxxxxxxxxxxxx>
- To: haiku-appserver@xxxxxxxxxxxxx
- Date: Wed, 06 Apr 2005 17:30:32 +0300
Hi,
Stephan Assmus wrote:
>> 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."
Yet, under R5 it works flawlessly.
> The thing I don't get is
> how BView::StringWidth() is related to BWindow::MoveBy().
BWindow::MoveBy() is called from the main thread(BApplication) (locked
until ::Run() is called) and tries to lock "BWindow's looper".
In the mean time BWindow's thread just received an _UPDATE_ request
(locked itself before calling DispatchMessage()) and called
HelloView::Draw(). In this 'Draw()' StringWidth() is called which tries
to lock BApplication so that it can use its ports for communicating with
app_server. Deadlock.
bye,
Adi.
|

|