summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-10-20 14:41:50 +0000
committerTomáš Chvátal <tchvatal@suse.cz>2011-10-21 11:16:57 +0200
commit4c2b93d96689f62c24ebdb2d4e87ac08d51ed53a (patch)
treedfd14d5ccd3e2d4c442e2dc11756aa9d8d2376e1
parent79801abff2e4764471a7b328f9150fe4feafe61f (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. Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz>
-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 32561d9c9e..4365ad6dbb 100644
--- a/vcl/unx/kde4/main.cxx
+++ b/vcl/unx/kde4/main.cxx
@@ -54,7 +54,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< Qt::ApplicationAttribute >( 10 ));
+#endif
+ }
#if QT_VERSION < 0x050000
// Qt 4.x support needs >= 4.1.0