You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-let-Qt-call-XInitThrea...

39 lines
1.4 KiB

From 6163c62a52794725188faf82ee12852f4b2cd023 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@suse.cz>
Date: Thu, 20 Oct 2011 16:41:50 +0200
Subject: [PATCH] let Qt call XInitThreads(), so that it knows it's been
called (fdo#40298)
Otherwise QPixmap complains when used outside of the main Qt thread
and resets itself to null pixmap, eventually leading to crashes.
---
vcl/unx/kde4/main.cxx | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx
index 9e0a361..482a212 100644
--- a/vcl/unx/kde4/main.cxx
+++ b/vcl/unx/kde4/main.cxx
@@ -56,7 +56,18 @@ extern "C" {
established, so protect X against itself
*/
if( ! ( pNoXInitThreads && *pNoXInitThreads ) )
+ {
+#if QT_VERSION >= 0x040800
+ // let Qt call XInitThreads(), so that also Qt knows it's been used
+ // (otherwise QPixmap may warn about threads not being initialized)
+ QApplication::setAttribute( Qt::AA_X11InitThreads );
+#else
XInitThreads();
+ // just in case somebody builds with old version and then upgrades Qt,
+ // otherwise this is a no-op
+ QApplication::setAttribute( static_cast< ApplicationAttribute >( 10 ));
+#endif
+ }
#if QT_VERSION < 0x050000
// Qt 4.x support needs >= 4.1.0
--
1.7.6.4