summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-02-22 12:40:26 +0200
committerTor Lillqvist <tml@collabora.com>2018-02-23 10:29:28 +0100
commitbb787afc61a8827e3840e892e2adb525df4df2cd (patch)
tree47df2daf841dbe5cc4439bf860d95c64024f7462 /vcl
parentc8bb752d21e25a1ba9b61e1197002e6d8c1746a5 (diff)
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 <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/50197 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 42a5a054b70c7850ca47074c2d5dd249de3202b4) Reviewed-on: https://gerrit.libreoffice.org/50224
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/salinst.hxx4
-rw-r--r--vcl/osx/salinst.cxx3
-rw-r--r--vcl/source/app/svmain.cxx4
3 files changed, 11 insertions, 0 deletions
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index ca8017d94513..3384b3a55c20 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -195,6 +195,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 b3b97e5ee01d..4d8c38091b7e 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 2d7950a8aa11..d5bab359586b 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -187,6 +187,10 @@ int ImplSVMain()
bool bInit = isInitVCL() || InitVCL();
+#ifdef MACOSX
+ postInitVCLinitNSApp();
+#endif
+
if( bInit )
{
// call application main