[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recent drawing optimizations
From: |
Alexander Malmberg |
Subject: |
Re: Recent drawing optimizations |
Date: |
Thu, 27 Mar 2003 16:29:02 +0100 |
Benhur Stein wrote:
[snip]
> I think I found it.
> It seems that a thread (not the main one) is calling (maybe indirectly)
> -[NSView setNeedsDisplay]. This method asks the run loop to call
> _handleWindowNeedsDisplay.
> The problem is that this is put in the runloop for the non-displaying
> thread, and when _handleWindowNeedsDisplay is called, the running
> thread has no graphics context associated with it.
>
> I'm not sure of what's the best solution to the problem.
Add the performer on the main thread's runloop, either indirectly using
[NSThread -performSelectorOnMainThread], or by getting the runloop from
the thread dictionary of the main thread.
I think the second method is better; I'm not sure NSThread's idea of
"main thread" will (or should have to) always correspond to the -gui
thread, so it's probably better to save the current thread when
initializing the backend and using it later.
- Alexander Malmberg