Mail app briefly blocks window in some circumstances
|Reported by:||anevilyak||Owned by:||axeld|
|Has a Patch:||no||Platform:||All|
Description (last modified by )
When a new mail window is opened via the mail app, certain timing circumstances can briefly cause window drawing to block for a second or so on start. This is due to the following set of circumstances:
- Spell check is enabled.
- When the window is started, it checks this setting and immediately posts a spell check BMessage if so.
- After being shown, said message is processed. The first thing it does is check if the application object has already loaded the dictionaries. If not, it then initiates a 1.5 second snooze  (!) on the window looper to wait for that. This may or may not occur depending on how quickly the dictionary load occurs, so this behavior is somewhat non-deterministic.
There are numerous problems here:
- The check simply looks if any dictionary whatsoever has been loaded, which doesn't necessarily guarantee that it's the one for the correct language.
- Obviously blocking the window this way is a no-no. Multiple possible solutions present themselves there: 1) the window could instead create a message runner to resend the message with a delay, and check again then rather than blocking, or preferably 2) Something could be put in place where the app notifies windows of dictionaries coming available via an observer notice, which could then cause the spell check to be initiated. Other solutions are entirely possible of course.
Note that this problem appears to originate from the original import of the MDR code in 2004.