summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2016-12-17 15:06:57 +0300
committerSlávek Banko <slavek.banko@axis.cz>2017-01-29 02:48:49 +0100
commit575df654fe61409c33e4295419a6fc40706221d1 (patch)
tree5f5ee90df63045b3e233c679157bb3ff6f11a66c
parentab10c24acefeb0ee30ac26fb61789cf999c58416 (diff)
downloadtdelibs-575df654fe61409c33e4295419a6fc40706221d1.tar.gz
tdelibs-575df654fe61409c33e4295419a6fc40706221d1.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)
-rw-r--r--tdecore/tdeapplication.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tdecore/tdeapplication.cpp b/tdecore/tdeapplication.cpp
index aa0e1e058..d19b4d942 100644
--- a/tdecore/tdeapplication.cpp
+++ b/tdecore/tdeapplication.cpp
@@ -2268,16 +2268,20 @@ bool TDEApplication::x11EventFilter( XEvent *_event )
void TDEApplication::updateUserTimestamp( unsigned long time )
{
#if defined Q_WS_X11
+ Display *display = tqt_xdisplay();
+ if (!display) {
+ return;
+ }
if( time == 0 )
{ // get current X timestamp
- Window w = XCreateSimpleWindow( tqt_xdisplay(), tqt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 );
+ Window w = XCreateSimpleWindow( display, tqt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 );
XSelectInput( tqt_xdisplay(), w, PropertyChangeMask );
unsigned char data[ 1 ];
- XChangeProperty( tqt_xdisplay(), w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 );
+ XChangeProperty( display, w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 );
XEvent ev;
- XWindowEvent( tqt_xdisplay(), w, PropertyChangeMask, &ev );
+ XWindowEvent( display, w, PropertyChangeMask, &ev );
time = ev.xproperty.time;
- XDestroyWindow( tqt_xdisplay(), w );
+ XDestroyWindow( display, w );
}
if( GET_QT_X_USER_TIME() == 0
|| NET::timestampCompare( time, GET_QT_X_USER_TIME() ) > 0 ) // check time > tqt_x_user_time