|
20 | 20 | #include <quartz/cgutils.h> |
21 | 21 |
|
22 | 22 | #include <salbmp.hxx> |
| 23 | +#include <salinst.hxx> |
23 | 24 | #ifdef MACOSX |
24 | 25 | #include <osx/saldata.hxx> |
25 | 26 | #else |
@@ -136,6 +137,31 @@ bool DefaultMTLDeviceIsSupported() |
136 | 137 | return bRet; |
137 | 138 | } |
138 | 139 |
|
| 140 | +void SalInstance::MacStartupWorkarounds() |
| 141 | +{ |
| 142 | + // HACK: When the first call to [NSSpellChecker sharedSpellChecker] (in |
| 143 | + // lingucomponent/source/spellcheck/macosxspell/macspellimp.mm) is done both on a thread other |
| 144 | + // than the main thread and with the SolarMutex erroneously locked, then that can lead to |
| 145 | + // deadlock as [NSSpellChecker sharedSpellChecker] internally calls |
| 146 | + // AppKit`-[NSSpellChecker init] -> |
| 147 | + // AppKit`-[NSSpellChecker _fillSpellCheckerPopupButton:] -> |
| 148 | + // AppKit`-[NSApplication(NSServicesMenuPrivate) _fillSpellCheckerPopupButton:] -> |
| 149 | + // AppKit`-[NSMenu insertItem:atIndex:] -> |
| 150 | + // Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] -> |
| 151 | + // CoreFoundation`_CFXNotificationPost -> |
| 152 | + // Foundation`-[NSOperation waitUntilFinished] |
| 153 | + // waiting for work to be done on the main thread, but the main thread is typically already |
| 154 | + // blocked (in some event handling loop) waiting to acquire the SolarMutex. The real solution |
| 155 | + // would be to fix all the cases where a call to [NSSpellChecker sharedSpellChecker] in |
| 156 | + // lingucomponent/source/spellcheck/macosxspell/macspellimp.mm is done while the SolarMutex is |
| 157 | + // locked (somewhere up the call chain), but that appears to be rather difficult (see e.g. |
| 158 | + // <https://bugs.documentfoundation.org/show_bug.cgi?id=151894> "FILEOPEN a Base Document with |
| 159 | + // customized event for open a startform by 'open document' LO stuck"). So, at least for now, |
| 160 | + // chicken out and do that first call to [NSSpellChecker sharedSpellChecker] upfront in a |
| 161 | + // controlled environment: |
| 162 | + [NSSpellChecker sharedSpellChecker]; |
| 163 | +} |
| 164 | + |
139 | 165 | #endif |
140 | 166 |
|
141 | 167 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
0 commit comments