Kaydet (Commit) 8bd289c4 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

tdf#103690: Set up notifications only after VCL has been initialised

On some Macs, it seems that LibreOffice (or any app?) gets an
NSApplicationDidChangeScreenParametersNotification as soon as it has
started and asked for such a notification. Our handler for that
notification assumes that VCL is initialised. Thus we should not ask
for such notifications before VCL has been initialised.

I could not reproduce the reported crash with an unmodified
LibreOffice, only after inserting a sleep after the notifications had
been set up. But I am fairly sure this change fixes the problem.

Change-Id: I18d342eb7dc0c77cb7fc8623756bead65a1bd329
Reviewed-on: https://gerrit.libreoffice.org/50164Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
üst d4b4f5f1
...@@ -205,6 +205,10 @@ void DeInitSalData(); // called from Application-Dtor ...@@ -205,6 +205,10 @@ void DeInitSalData(); // called from Application-Dtor
void InitSalMain(); void InitSalMain();
#ifdef MACOSX
void postInitVCLinitNSApp();
#endif
#endif // INCLUDED_VCL_INC_SALINST_HXX #endif // INCLUDED_VCL_INC_SALINST_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -157,7 +157,10 @@ static void initNSApp() ...@@ -157,7 +157,10 @@ static void initNSApp()
// activate our delegate methods // activate our delegate methods
[NSApp setDelegate: NSApp]; [NSApp setDelegate: NSApp];
}
void postInitVCLinitNSApp()
{
[[NSNotificationCenter defaultCenter] addObserver: NSApp [[NSNotificationCenter defaultCenter] addObserver: NSApp
selector: @selector(systemColorsChanged:) selector: @selector(systemColorsChanged:)
name: NSSystemColorsDidChangeNotification name: NSSystemColorsDidChangeNotification
......
...@@ -187,6 +187,10 @@ int ImplSVMain() ...@@ -187,6 +187,10 @@ int ImplSVMain()
bool bInit = isInitVCL() || InitVCL(); bool bInit = isInitVCL() || InitVCL();
#ifdef MACOSX
postInitVCLinitNSApp();
#endif
if( bInit ) if( bInit )
{ {
// call application main // call application main
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment