[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]The new controls (was: Phoenix)
From: |
Rhys Weatherley |
Subject: |
Re: [DotGNU]The new controls (was: Phoenix) |
Date: |
Fri, 25 Jul 2003 13:05:48 +1000 |
User-agent: |
KMail/1.4.3 |
On Friday 25 July 2003 10:32 am, Gopal V wrote:
> The TextBox thing keeps freezing after about 50 chars are typed
> in ... (also the blinking caret fooled me into thinking I had
> focus already)... I hope these are the bugginess mentioned
> above ?
I've fixed the TextBox lockup now. It was a consequence of not properly
disposing "Graphics" objects that were created using "CreateGraphics()". The
exact sequence of events was something like this:
- Main thread creates a graphics object, uses it, and then forgets about it.
- The main thread re-enters the main event loop in "Xsharp.Display", which
causes the display lock to be acquired.
- The GC finalizes the graphics object, eventually calling the "Dispose"
method in "Xsharp.Graphics".
- "Dispose" tries to acquire the display lock, and blocks waiting for the
main thread.
- The user performs some action that causes an event.
- The main thread wakes up, immediately tries to allocate something (before
releasing the display lock), and then blocks waiting for the GC to complete
the finalization process. Which it never will because it is waiting for the
display lock.
Whoops! Deadlock!
By manually disposing the "Graphics" objects in "TextBox", the deadlock is
avoided.
I need to perform a little surgery on "Xsharp" to prevent the display lock
from being held while waiting for an event, so that finalization will work OK
in the future, but the immediate problem has been solved.
Cheers,
Rhys.