diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2016-12-17 15:06:57 +0300 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-07-22 15:56:50 +0200 |
commit | 0b91193d5d1d329dd4086e3fcb3e0be36bdfea8a (patch) | |
tree | 5515376bb2919981b993bd79e82995ca1eed7af6 /kdecore | |
parent | b1a20aabbeb10811c8a75812dcf32fcd3bae3291 (diff) | |
download | tdelibs-0b91193d5d1d329dd4086e3fcb3e0be36bdfea8a.tar.gz tdelibs-0b91193d5d1d329dd4086e3fcb3e0be36bdfea8a.zip |
tdecore: fix a crash of dcop non-GUI apps without X
Previously non-GUI apps crashed on TDEApplication::updateUserTimestamp
callback when receiving a DCOP message.
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit 5842fb37df7a01decb2151a570f58fb2528b3ccd)
Diffstat (limited to 'kdecore')
-rw-r--r-- | kdecore/kapplication.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kdecore/kapplication.cpp b/kdecore/kapplication.cpp index 1ca402e4a..917577888 100644 --- a/kdecore/kapplication.cpp +++ b/kdecore/kapplication.cpp @@ -2204,16 +2204,20 @@ bool KApplication::x11EventFilter( XEvent *_event ) void KApplication::updateUserTimestamp( unsigned long time ) { #if defined Q_WS_X11 + Display *display = qt_xdisplay(); + if (!display) { + return; + } if( time == 0 ) { // get current X timestamp - Window w = XCreateSimpleWindow( qt_xdisplay(), qt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 ); + Window w = XCreateSimpleWindow( display, qt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 ); XSelectInput( qt_xdisplay(), w, PropertyChangeMask ); unsigned char data[ 1 ]; - XChangeProperty( qt_xdisplay(), w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 ); + XChangeProperty( display, w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 ); XEvent ev; - XWindowEvent( qt_xdisplay(), w, PropertyChangeMask, &ev ); + XWindowEvent( display, w, PropertyChangeMask, &ev ); time = ev.xproperty.time; - XDestroyWindow( qt_xdisplay(), w ); + XDestroyWindow( display, w ); } if( GET_QT_X_USER_TIME() == 0 || NET::timestampCompare( time, GET_QT_X_USER_TIME() ) > 0 ) // check time > qt_x_user_time |