1 |
From 2d3aabf379d546684f3229e14752a86d784feaa5 Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@collabora.com> |
3 |
Date: Tue, 25 Mar 2014 12:20:16 +0100 |
4 |
Subject: [PATCH 2/2] prevent KDE/Qt from interfering with the session manager |
5 |
|
6 |
I occassionally get lockups in IceProcessMessages() called from QtCore, |
7 |
I'm actually not exactly sure why, as theoretically two connections |
8 |
from one app shouldn't be a problem, but since LO does its own |
9 |
session handling, there's no need to the KDE/Qt code to be involved, |
10 |
so prevent it from connecting to the session manager altogether. |
11 |
|
12 |
Change-Id: Iebe20d4cb5403e5fea8bd5d8c1f69b62d1c2907b |
13 |
--- |
14 |
vcl/unx/kde4/KDEXLib.cxx | 17 ++++++++++++++++- |
15 |
vcl/unx/kde4/VCLKDEApplication.hxx | 8 -------- |
16 |
2 files changed, 16 insertions(+), 9 deletions(-) |
17 |
|
18 |
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx |
19 |
index 820d39a..e4900a7 100644 |
20 |
--- a/vcl/unx/kde4/KDEXLib.cxx |
21 |
+++ b/vcl/unx/kde4/KDEXLib.cxx |
22 |
@@ -166,8 +166,23 @@ void KDEXLib::Init() |
23 |
|
24 |
KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs, kAboutData ); |
25 |
|
26 |
+ // LO does its own session management, so prevent KDE/Qt from interfering |
27 |
+ // (QApplication::disableSessionManagement(false) wouldn't quite do, |
28 |
+ // since that still actually connects to the session manager, it just |
29 |
+ // won't save the application data on session shutdown). |
30 |
+ char* session_manager = NULL; |
31 |
+ if( getenv( "SESSION_MANAGER" ) != NULL ) |
32 |
+ { |
33 |
+ session_manager = strdup( getenv( "SESSION_MANAGER" )); |
34 |
+ unsetenv( "SESSION_MANAGER" ); |
35 |
+ } |
36 |
m_pApplication = new VCLKDEApplication(); |
37 |
- kapp->disableSessionManagement(); |
38 |
+ if( session_manager != NULL ) |
39 |
+ { |
40 |
+ setenv( "SESSION_MANAGER", session_manager, 1 ); |
41 |
+ free( session_manager ); |
42 |
+ } |
43 |
+ |
44 |
KApplication::setQuitOnLastWindowClosed(false); |
45 |
|
46 |
#if KDE_HAVE_GLIB |
47 |
diff --git a/vcl/unx/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx |
48 |
index 412ee34..4ce0b2c 100644 |
49 |
--- a/vcl/unx/kde4/VCLKDEApplication.hxx |
50 |
+++ b/vcl/unx/kde4/VCLKDEApplication.hxx |
51 |
@@ -21,22 +21,14 @@ |
52 |
|
53 |
#define Region QtXRegion |
54 |
|
55 |
-#include <QSessionManager> |
56 |
- |
57 |
#include <kapplication.h> |
58 |
|
59 |
#undef Region |
60 |
|
61 |
-/* #i59042# override KApplications method for session management |
62 |
- * since it will interfere badly with our own. |
63 |
- */ |
64 |
class VCLKDEApplication : public KApplication |
65 |
{ |
66 |
public: |
67 |
VCLKDEApplication(); |
68 |
- |
69 |
- virtual void commitData(QSessionManager&) {}; |
70 |
- |
71 |
virtual bool x11EventFilter(XEvent* event); |
72 |
}; |
73 |
|
74 |
-- |
75 |
1.9.0 |
76 |
|