summaryrefslogtreecommitdiff
path: root/vcl/unx/kde4
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-10-20 16:41:50 +0200
committerLuboš Luňák <l.lunak@suse.cz>2011-10-20 16:52:38 +0200
commit6163c62a52794725188faf82ee12852f4b2cd023 (patch)
tree0a3a8d8d5367ba56146b93aefc890cbf4231a062 /vcl/unx/kde4
parentbce48fb94b1ff2f87fac7185ff5a9904bcf83484 (diff)
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.
Diffstat (limited to 'vcl/unx/kde4')
-rw-r--r--vcl/unx/kde4/main.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx
index 9e0a36120222..482a2125667d 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