vcl/inc/salinst.hxx       |    4 ++++
 vcl/osx/salinst.cxx       |    3 +++
 vcl/source/app/svmain.cxx |    4 ++++
 3 files changed, 11 insertions(+)

New commits:
commit eb9e6c87622ef5436abf75a87f4868d5d0e826a1
Author: Tor Lillqvist <t...@collabora.com>
Date:   Thu Feb 22 12:40:26 2018 +0200

    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/50164
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/50197
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit 42a5a054b70c7850ca47074c2d5dd249de3202b4)
    Reviewed-on: https://gerrit.libreoffice.org/50209
    Tested-by: Tor Lillqvist <t...@collabora.com>

diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index da8b6dea8412..52466ac650d7 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -196,6 +196,10 @@ void DeInitSalData();                       // called from 
Application-Dtor
 
 void InitSalMain();
 
+#ifdef MACOSX
+void postInitVCLinitNSApp();
+#endif
+
 #endif // INCLUDED_VCL_INC_SALINST_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 4cd82d66bd94..b0c89ba81856 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -150,7 +150,10 @@ static void initNSApp()
 
     // activate our delegate methods
     [NSApp setDelegate: NSApp];
+}
 
+void postInitVCLinitNSApp()
+{
     [[NSNotificationCenter defaultCenter] addObserver: NSApp
                                           selector: 
@selector(systemColorsChanged:)
                                           name: 
NSSystemColorsDidChangeNotification
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 2cd613727ab4..ca1fb4f1f457 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -178,6 +178,10 @@ int ImplSVMain()
 
     bool bInit = isInitVCL() || InitVCL();
 
+#ifdef MACOSX
+    postInitVCLinitNSApp();
+#endif
+
     if( bInit )
     {
         // call application main
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to